jason810496 commented on code in PR #56150:
URL: https://github.com/apache/airflow/pull/56150#discussion_r2799797914


##########
shared/observability/src/airflow_shared/observability/metrics/otel_logger.py:
##########
@@ -387,28 +390,32 @@ def get_otel_logger(
     stat_name_handler: Callable[[str], str] | None = None,
     statsd_influxdb_enabled: bool = False,
 ) -> SafeOtelLogger:
-    effective_service_name: str = service_name or "airflow"
+    otel_env_config = load_metrics_env_config()
+
+    effective_service_name: str = otel_env_config.service_name or service_name

Review Comment:
   > `effective_service_name: str = otel_env_config.service_name or 
service_name`
   
   However, it seems we didn’t handle the case when ‎`OTEL_SERVICE_NAME` and 
the Airflow config for ‎`otel_service` are both unset.
   
   Same as `otel_env_config.interval_ms`.
   Should we add fallback value on `load_otel_env_config` side or raise 
warning/error ?
   



##########
shared/observability/src/airflow_shared/observability/metrics/otel_logger.py:
##########
@@ -387,28 +390,32 @@ def get_otel_logger(
     stat_name_handler: Callable[[str], str] | None = None,
     statsd_influxdb_enabled: bool = False,
 ) -> SafeOtelLogger:
-    effective_service_name: str = service_name or "airflow"
+    otel_env_config = load_metrics_env_config()
+
+    effective_service_name: str = otel_env_config.service_name or service_name

Review Comment:
   Maybe this only matters for  `otel_env_config.service_name`. It should be 
fine for `otel_env_config.interval_ms`.
   
   Since `export_interval_millis` parameter of `PeriodicExportingMetricReader` 
allows a `float` or `None`, so `otel_env_config.interval_ms` is safe.
   
   For `effective_service_name`, we just casting `None` to `str`, so it's 
entirely possible for it to become `None` in all the case of 
`effective_service_name: str = otel_env_config.service_name or service_name`. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to