This is an automated email from the ASF dual-hosted git repository.

rom pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v2-10-test by this push:
     new 4849328bb4 apply otel_service on metrics (#42242) (#42441)
4849328bb4 is described below

commit 4849328bb49dfbf942acb19a1803ace2c40401e8
Author: rom sharon <[email protected]>
AuthorDate: Wed Sep 25 08:00:26 2024 +0300

    apply otel_service on metrics (#42242) (#42441)
    
    * apply otel_service on metrics
    
    * change version_added to 2.10.3
    
    (cherry picked from commit e14b4cae9c61cbf1df6e6b573d926d614f9f63e5)
---
 airflow/config_templates/config.yml | 7 +++++++
 airflow/metrics/otel_logger.py      | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/airflow/config_templates/config.yml 
b/airflow/config_templates/config.yml
index 782c5217c7..00d7cacc7f 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -1232,6 +1232,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 5dac960c16..4d6f1c725e 100644
--- a/airflow/metrics/otel_logger.py
+++ b/airflow/metrics/otel_logger.py
@@ -396,8 +396,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"

Reply via email to