Airflow 2.10.X and standalone OpenTelemetry Collector integration #63808
-
|
I'm trying to integrate Airflow 2.10.5 with a standalone OpenTelemetry Collector version 0.70, following the suggested setup script https://github.com/apache/airflow/blob/2.10.2/scripts/ci/docker-compose/integration-otel.yml. However, I'm encountering a 400 Bad Request error. The OpenTelemetry Collector logs don't show any entries related to the HTTP request. Any ideas on what might be going wrong or how to debug this further? I also try gRPC via 4317, but airflow not switch to gRPC protocol and continuously send HTTP requests This works and return 200, but nothing on otel logs I also tested with the latest OpenTelemetry Collector (v0.146). The error changed from 400 to 500 Internal Server Error, but the collector logs remain completely empty. No entries appear even with debug logging enabled. I tried tune exporter settings on airflow side using protocol settings - https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, etc but without any success I use following airflow ENV: - AIRFLOW__METRICS__OTEL_ON=True
- AIRFLOW__METRICS__OTEL_HOST=otel-collector
- AIRFLOW__METRICS__OTEL_PORT=4318
- AIRFLOW__METRICS__OTEL_INTERVAL_MILLISECONDS=30000
- AIRFLOW__TRACES__OTEL_ON=True
- AIRFLOW__TRACES__OTEL_HOST=otel-collector
- AIRFLOW__TRACES__OTEL_PORT=4318
- AIRFLOW__TRACES__OTEL_DEBUGGING_ON=False
- AIRFLOW__TRACES__OTEL_TASK_LOG_EVENT=Trueand installed otel plugin via apache-airflow[otel] opentelemetry-api 1.40.0
opentelemetry-exporter-otlp 1.40.0
opentelemetry-exporter-otlp-proto-common 1.40.0
opentelemetry-exporter-otlp-proto-grpc 1.40.0
opentelemetry-exporter-otlp-proto-http 1.40.0
opentelemetry-exporter-prometheus 0.61b0
opentelemetry-proto 1.40.0
opentelemetry-sdk 1.40.0
opentelemetry-semantic-conventions 0.61b0otel/prometheus setup otel-collector:
image: otel/opentelemetry-collector-contrib:0.70.0
command: [--config=/etc/otel-collector-config.yml]
volumes:
- ./otel-collector-config.yml:/etc/otel-collector-config.yml
ports:
- "24318:4318"
- "28889:8889"
prometheus:
image: prom/prometheus
user: "0"
ports:
- "29090:9090"
volumes:
- ./prometheus-config.yml:/etc/prometheus/prometheus.ymlotel config: receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
grpc:
endpoint: 0.0.0.0:4317
processors:
batch:
exporters:
logging:
verbosity: detailed
prometheus:
endpoint: 0.0.0.0:8889
service:
telemetry:
logs:
level: debug
development: true
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [logging, prometheus]
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging] |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
I get packet capture, and it's seems like airflow send binary protobuf body with application/json header, and reicive 400 bad request on this body. it's should be application/x-protobuf, but content type is hardcoded https://github.com/apache/airflow/blob/2.10.5/airflow/metrics/otel_logger.py#L410 |
Beta Was this translation helpful? Give feedback.
-
|
Tke root of problem is wrong version of installed opentelemetry-exporter on airflow, I don't use constraint for installation and installed lastest version, there is user defined header had top priority rather on suggested opentelemetry-exporter == 1.27.0 on constraints But, seems like we not needed to hardcode conte-type on otel_logger.py in airflow, it's better to setup via OTEL_ settings. self._session.headers.update(self._headers)
self._session.headers.update(_OTLP_HTTP_HEADERS)
# let users override our defaults
self._session.headers.update(self._headers) |
Beta Was this translation helpful? Give feedback.
Tke root of problem is wrong version of installed opentelemetry-exporter on airflow, I don't use constraint for installation and installed lastest version, there is user defined header had top priority rather on suggested opentelemetry-exporter == 1.27.0 on constraints
But, seems like we not needed to hardcode conte-type on otel_logger.py in airflow, it's better to setup via OTEL_ settings.