Skip to content

Python: OTLP HTTP exporter sends to bare base endpoint instead of /v1/{signal} path #5912

@droideronline

Description

@droideronline

Bug Report

Summary

When configuring OpenTelemetry export via OTEL_EXPORTER_OTLP_ENDPOINT with an HTTP protocol (http/protobuf or http), traces, metrics, and logs are sent to the bare base URL (e.g. http://localhost:4318) instead of the correct signal-specific paths (http://localhost:4318/v1/traces, /v1/metrics, /v1/logs).

Affected Component

python/packages/core/agent_framework/observability.py_get_exporters_from_env()

Root Cause

Per the OpenTelemetry specification, OTEL_EXPORTER_OTLP_ENDPOINT is a base URL for HTTP transport — the SDK automatically appends /v1/traces, /v1/metrics, or /v1/logs when it reads the env var directly. Signal-specific env vars (OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, etc.) are full URLs used verbatim.

_get_exporters_from_env was reading the base endpoint and forwarding it directly as the endpoint= constructor argument to the exporter. The OTel SDK always treats a programmatically-provided endpoint= argument as a full URL (no auto-append). This meant the /v1/{signal} path was silently dropped.

Reproduction

import os
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "http://localhost:4318"
os.environ["OTEL_EXPORTER_OTLP_PROTOCOL"] = "http/protobuf"

# Exporters will attempt to POST to http://localhost:4318
# instead of http://localhost:4318/v1/traces (etc.)
configure_azure_monitor(...)  # or enable_telemetry(...)

With a collector listening on http://localhost:4318, no spans/metrics/logs are received because the POST goes to the wrong path and returns 404.

Expected Behavior

With OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 and OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf:

  • Traces exporter → http://localhost:4318/v1/traces
  • Metrics exporter → http://localhost:4318/v1/metrics
  • Logs exporter → http://localhost:4318/v1/logs

Signal-specific env vars (e.g. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) continue to be used verbatim (no path appended).

gRPC behavior is unchanged — the base endpoint is used as-is for gRPC.

Fix

Replicate the OTel spec's auto-append logic inside _get_exporters_from_env when falling back to the base endpoint under HTTP protocol. See the linked PR for the change and added test coverage.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions