Simplify OTEL metrics config to mirror traces pattern#68393
Conversation
…tel-logger-config
…nfig' into dsuhinin/simplify-otel-logger-config
…nfig' into dsuhinin/simplify-otel-logger-config
…nfig' into dsuhinin/simplify-otel-logger-config
…nfig' into dsuhinin/simplify-otel-logger-config
|
@dsuhinin This PR has been converted to draft because it does not yet meet our Pull Request quality criteria. Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the Airflow Slack. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
…tel-logger-config # Conflicts: # shared/observability/tests/observability/test_traces.py
Mirror
airflow_shared.observability.traces.configure_otel's shape in the metrics module so both halves of the OTel config story have one entry point, one conf-driven setup function, and the same backcompat-bridging contract.What changes
airflow_shared.observability.metrics.configure_otel(conf)— a single conf-driven entry point that bridges deprecated Airflow configs (metrics.otel_host/otel_port/otel_ssl_active/otel_service/otel_interval_milliseconds) into the standard OTel env vars, loads the exporter viathe SDK's entry-point mechanism, installs the global
MeterProvider, and returns aSafeOtelLoggerfor the Stats factory.get_otel_logger(host=, port=, ssl_active=, prefix=, conf_interval=, debug=, ...)function and the helperget_otel_data_exporterthat duplicated the OTel SDK's own exporter dispatch.airflow-coreand the near-identical one intask-sdk. Bothstats_utils.pyfiles now wire directly toconfigure_otel.otel_env_config.py(entirely unused after the bridging consolidated into_get_backcompat_config).OTel environment variables take precedence over the deprecated Airflow configs in every code path, matching the rule already used in
traces/configure_otel. IPv6 host bracketing in the bridged URL is preserved via_format_url_host.Why
Before: 11-parameter shared function + 4-parameter exporter helper + a 26-line shim duplicated across two distributions + an unused env-config dataclass module. Net ~700 lines for what is, conceptually, "read conf, bridge to env, install provider."
After: one
configure_otel(conf)function that follows the same shape as the existing traces module. ~225 fewer lines net. New developers who learn one module understand the other immediately.Verified
AIRFLOW__METRICS__OTEL_*configs (no env vars set) arrived at a real OTel collector — proving the bridging works end-to-end through the OTel SDK pipeline.Important
🛠️ Maintainer triage note for @dsuhinin · by
@potiuk· 2026-07-15 16:20 UTCThe
ready for maintainer reviewlabel was removed — the next move is yours (see our Pull Request quality criteria):main. See docs.The ball is in your court — you've been assigned to this PR. Rebase on
main, resolve conflicts, then mark it Ready for review again.Automated triage — may be imperfect; a maintainer takes the next look.