Skip to content

Commit 4bc55cb

Browse files
committed
append /v1/traces to base OTEL_EXPORTER_OTLP_ENDPOINT fallback
1 parent fe38f99 commit 4bc55cb

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_configurator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,11 @@ def _export_unsampled_span_for_agent_observability(trace_provider: TracerProvide
330330
if not is_agent_observability_enabled():
331331
return
332332

333-
traces_endpoint = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) or os.environ.get(
334-
"OTEL_EXPORTER_OTLP_ENDPOINT"
335-
)
333+
traces_endpoint = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT)
334+
if not traces_endpoint:
335+
base_endpoint = os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT")
336+
if base_endpoint:
337+
traces_endpoint = base_endpoint.rstrip("/") + "/v1/traces"
336338
if not traces_endpoint:
337339
return
338340

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,7 @@ def test_export_unsampled_span_for_agent_observability(self):
11101110
self.assertEqual(mock_tracer_provider.add_span_processor.call_count, 1)
11111111
processor = mock_tracer_provider.add_span_processor.call_args_list[0].args[0]
11121112
self.assertIsInstance(processor, BatchUnsampledSpanProcessor)
1113+
self.assertEqual(processor.span_exporter._endpoint, "http://localhost:4318/v1/traces")
11131114

11141115
os.environ.pop("AGENT_OBSERVABILITY_ENABLED", None)
11151116
os.environ.pop("OTEL_EXPORTER_OTLP_ENDPOINT", None)

0 commit comments

Comments
 (0)