dsuhinin opened a new pull request, #68393:
URL: https://github.com/apache/airflow/pull/68393

   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
   
     - **New**: `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 via
      the SDK's entry-point mechanism, installs the global `MeterProvider`, and 
returns a `SafeOtelLogger` for the Stats factory.
     - **Removed**: the 11-parameter `get_otel_logger(host=, port=, 
ssl_active=, prefix=, conf_interval=, debug=, ...)` function and the helper 
`get_otel_data_exporter` that duplicated the OTel SDK's own exporter dispatch.
     - **Removed**: the 26-line shim file in `airflow-core` and the 
near-identical one in `task-sdk`. Both `stats_utils.py` files now wire directly 
to `configure_otel`.
     - **Removed**: `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`. Fork-safety reset (#64690) and the 
`ExponentialBucketHistogram` view
     are preserved verbatim.
   
     ## 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
   
     - Unit tests: 41/41 pass (8 parametrize cases for the new bridging 
contract; protocol-dispatch sub-tests dropped because they exercised SDK 
internals, not our code).
     - End-to-end: metrics emitted via the deprecated 
`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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to