Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply otel_service on metrics #42242

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,13 @@ metrics:
type: string
example: ~
default: "False"
otel_service:
description: |
The default service name of traces.
version_added: 2.10.3
type: string
example: ~
default: "Airflow"
otel_ssl_active:
description: |
If ``True``, SSL will be enabled. Defaults to ``False``.
Expand Down
3 changes: 2 additions & 1 deletion airflow/metrics/otel_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ def get_otel_logger(cls) -> SafeOtelLogger:
# PeriodicExportingMetricReader will default to an interval of 60000 millis.
interval = conf.getint("metrics", "otel_interval_milliseconds", fallback=None) # ex: 30000
debug = conf.getboolean("metrics", "otel_debugging_on")
service_name = conf.get("metrics", "otel_service")

resource = Resource(attributes={SERVICE_NAME: "Airflow"})
resource = Resource(attributes={SERVICE_NAME: service_name})

protocol = "https" if ssl_active else "http"
endpoint = f"{protocol}://{host}:{port}/v1/metrics"
Expand Down