Skip to content

Commit e14b4ca

Browse files
authored
apply otel_service on metrics (apache#42242)
* apply otel_service on metrics * change version_added to 2.10.3
1 parent 57eed58 commit e14b4ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

airflow/config_templates/config.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,13 @@ metrics:
12381238
type: string
12391239
example: ~
12401240
default: "False"
1241+
otel_service:
1242+
description: |
1243+
The default service name of traces.
1244+
version_added: 2.10.3
1245+
type: string
1246+
example: ~
1247+
default: "Airflow"
12411248
otel_ssl_active:
12421249
description: |
12431250
If ``True``, SSL will be enabled. Defaults to ``False``.

airflow/metrics/otel_logger.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,9 @@ def get_otel_logger(cls) -> SafeOtelLogger:
408408
# PeriodicExportingMetricReader will default to an interval of 60000 millis.
409409
interval = conf.getint("metrics", "otel_interval_milliseconds", fallback=None) # ex: 30000
410410
debug = conf.getboolean("metrics", "otel_debugging_on")
411+
service_name = conf.get("metrics", "otel_service")
411412

412-
resource = Resource(attributes={SERVICE_NAME: "Airflow"})
413+
resource = Resource(attributes={SERVICE_NAME: service_name})
413414

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

0 commit comments

Comments
 (0)