diff --git a/airflow/config_templates/config.yml b/airflow/config_templates/config.yml index bc749ad6b7343..3bef18058dfbb 100644 --- a/airflow/config_templates/config.yml +++ b/airflow/config_templates/config.yml @@ -1238,6 +1238,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``. diff --git a/airflow/metrics/otel_logger.py b/airflow/metrics/otel_logger.py index 594046703eb18..14080eb2d8313 100644 --- a/airflow/metrics/otel_logger.py +++ b/airflow/metrics/otel_logger.py @@ -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"