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


##########
shared/observability/src/airflow_shared/observability/traces/otel_tracer.py:
##########
@@ -339,18 +343,54 @@ def get_otel_tracer(
     otel_service: str | None = None,
     debug: bool = False,
 ) -> OtelTrace:
-    """Get OTEL tracer from airflow configuration."""
+    """Get OTEL tracer from the regular OTel env variables or the airflow 
configuration."""
+    otel_env_config = load_traces_env_config()
+
     tag_string = cls.get_constant_tags()
 
     protocol = "https" if ssl_active else "http"
-    # Allow transparent support for standard OpenTelemetry SDK environment 
variables.
-    # 
https://opentelemetry.io/docs/specs/otel/protocol/exporter/#configuration-options
-    endpoint = os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", 
f"{protocol}://{host}:{port}/v1/traces")
+    # According to the OpenTelemetry Spec, specific config options like 
'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'
+    # take precedence over generic ones like 'OTEL_EXPORTER_OTLP_ENDPOINT'.
+    env_exporter_protocol = (
+        otel_env_config.type_specific_exporter_protocol or 
otel_env_config.exporter_protocol
+    )
+    env_endpoint = otel_env_config.type_specific_endpoint or 
otel_env_config.base_endpoint
+
+    # If the protocol env var isn't set, then it will be None,
+    # and it will default to an http/protobuf exporter.
+    if env_endpoint and env_exporter_protocol == "grpc":

Review Comment:
   You are right. The only thing that changes is the type of exporter and the 
exporter imports. Let me look into it.



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