Skip to content

Document custom OTel metrics endpoint paths - #75453

Open
elhussienysabry wants to merge 1 commit into
apache:mainfrom
elhussienysabry:docs/otel-metrics-custom-path
Open

elhussienysabry wants to merge 1 commit into
apache:mainfrom
elhussienysabry:docs/otel-metrics-custom-path

Conversation

@elhussienysabry

@elhussienysabry elhussienysabry commented Oct 23, 2026 •

Copy link
Copy Markdown

Summary

The custom OTLP metrics path requested in #42492 is already supported through the signal-specific
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT environment variable. Airflow does not rewrite that endpoint,
so a backend path such as VictoriaMetrics' /opentelemetry/api/v1/push is preserved. /v1/metrics
is only constructed when Airflow falls back to the deprecated otel_host/otel_port settings, and
the OpenTelemetry SDK also appends it to the generic OTEL_EXPORTER_OTLP_ENDPOINT base URL.

This PR documents that behavior and adds regression coverage for it. It deliberately does not add a
new otel_path key to the deprecated otel_host/otel_port configuration block.

Prior art: #72073 reached the same conclusion but was closed under the open-PR limit, not for
technical reasons. This version keeps the existing gRPC precedence case and adds a separate HTTP
path-preservation case.

Changes

  • airflow-core/docs/administration-and-deployment/logging-monitoring/metrics.rst: explain how to
    use OTEL_EXPORTER_OTLP_METRICS_ENDPOINT for a non-default path, with a VictoriaMetrics example,
    and clarify why the generic endpoint is not a substitute.
  • shared/observability/tests/observability/metrics/test_otel_logger.py: add an HTTP case that
    asserts a custom metrics path is preserved exactly. The existing gRPC precedence case is kept
    because gRPC targets cannot carry a path.

Testing

  • cd shared/observability && uv run --project . pytest tests/observability/metrics -q — 159
    passed, 2 warnings.
  • prek run --files airflow-core/docs/administration-and-deployment/logging-monitoring/metrics.rst shared/observability/tests/observability/metrics/test_otel_logger.py — passed.
  • ruff format and ruff check --fix on the test file — clean.

closes: #42492


Was generative AI tooling used to co-author this PR?
  • Yes (OpenCode with DeepSeek V4.1 Flash)

Generated-by: OpenCode (DeepSeek V4.1 Flash) following the guidelines

Use OTEL_EXPORTER_OTLP_METRICS_ENDPOINT for backends that expect a non-default path, and add an HTTP regression test that asserts the path is preserved. The generic endpoint remains a base URL and is not suitable for custom paths.

Closes apache#42492
@boring-cyborg

boring-cyborg Bot commented Oct 23, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide configuration option to configure path of OTEL metrics exporter

1 participant