1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-23 22:34:47 +02:00
Files
opentelemetry-go/internal
Matt Quinn 1636bcdd1d fix(otlptrace,otlpmetric): remove endpoint URL path cleaning (#6710)
When setting an explicit OTLP traces endpoint URL (via
`otlptracehttp.WithEndpointURL` or the
`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` environment variable), any given
trailing slash is stripped. This makes it impossible to export traces to
an endpoint requiring a trailing slash. It also conflicts with [the
spec](https://opentelemetry.io/docs/specs/otel/protocol/exporter/#endpoint-urls-for-otlphttp):

> For the per-signal variables (OTEL_EXPORTER_OTLP_\<signal\>_ENDPOINT),
the URL MUST be used as-is without any modification. The only exception
is that if an URL contains no path part, the root path / MUST be used
(see [Example
2](https://opentelemetry.io/docs/specs/otel/protocol/exporter/#example-2)).

This stripping happens due to [the use of `path.Clean` in
`otlpconfig.cleanPath`](b4b461d050/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go (L97)).
From [the `path.Clean` docs](https://pkg.go.dev/path#Clean):

> The returned path ends in a slash only if it is the root "/".

Fixes #6709.
2025-06-03 07:12:49 +02:00
..