Skip to content

Commit ec1c4dc

Browse files
romsharon98utkarsharma2
authored andcommitted
apply otel_service on metrics (#42242) (#42441)
* apply otel_service on metrics * change version_added to 2.10.3 (cherry picked from commit e14b4ca)
1 parent 3fc3a54 commit ec1c4dc

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
@@ -1232,6 +1232,13 @@ metrics:
12321232
type: string
12331233
example: ~
12341234
default: "False"
1235+
otel_service:
1236+
description: |
1237+
The default service name of traces.
1238+
version_added: 2.10.3
1239+
type: string
1240+
example: ~
1241+
default: "Airflow"
12351242
otel_ssl_active:
12361243
description: |
12371244
If ``True``, SSL will be enabled. Defaults to ``False``.

airflow/metrics/otel_logger.py

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

400-
resource = Resource(attributes={SERVICE_NAME: "Airflow"})
401+
resource = Resource(attributes={SERVICE_NAME: service_name})
401402

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

0 commit comments

Comments
 (0)