xBis7 commented on code in PR #74046:
URL: https://github.com/apache/airflow/pull/74046#discussion_r4336612742


##########
task-sdk/src/airflow/sdk/observability/metrics/otel_logger.py:
##########
@@ -16,16 +16,38 @@
 # under the License.
 from __future__ import annotations
 
+import os
 from typing import TYPE_CHECKING
 
+from opentelemetry.sdk.resources import SERVICE_INSTANCE_ID
+
 from airflow.sdk._shared.observability.metrics import otel_logger
+from airflow.sdk._shared.observability.otel_env_config import 
load_metrics_env_config
 from airflow.sdk.configuration import conf
 
 if TYPE_CHECKING:
     from airflow.sdk._shared.observability.metrics.otel_logger import 
SafeOtelLogger
 
 
-def get_otel_logger() -> SafeOtelLogger:
+def get_otel_logger(short_lived: bool = False) -> SafeOtelLogger:
+    service_instance_id = None
+    temporality_preference_env = 
"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE"
+
+    if short_lived:
+        # The temporality env variable defaults to `CUMULATIVE` if unset.
+        # If the process is `short_lived`, then set the default fallback to 
`DELTA`.
+        os.environ.setdefault(temporality_preference_env, "DELTA")

Review Comment:
   This is just setting the default. If a user has provided a value, then the 
user value wins 



-- 
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