Skip to content

fix(otlptrace,otlpmetric): remove endpoint URL path cleaning #6710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/sdk/trace`. (#6835)
- The semantic conventions have been upgraded from `v1.26.0` to `v1.34.0` in `go.opentelemetry.io/otel/trace`. (#6836)

### Fixed

- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#6710)
- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#6710)
- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#6710)
- Stop stripping trailing slashes from configured endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#6710)

<!-- Released section -->
<!-- Don't change this section unless doing release -->

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions internal/shared/otlp/otlpmetric/oconf/options.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ func NewHTTPConfig(opts ...HTTPOption) Config {
return cfg
}

// cleanPath returns a path with all spaces trimmed and all redundancies
// removed. If urlPath is empty or cleaning it results in an empty string,
// cleanPath returns a path with all spaces trimmed. If urlPath is empty,
// defaultPath is returned instead.
func cleanPath(urlPath string, defaultPath string) string {
tmp := path.Clean(strings.TrimSpace(urlPath))
if tmp == "." {
tmp := strings.TrimSpace(urlPath)
if tmp == "" || tmp == "." {
return defaultPath
}
if !path.IsAbs(tmp) {
Expand Down
12 changes: 2 additions & 10 deletions internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,10 @@ func TestCleanPath(t *testing.T) {
{
name: "clean traces path",
args: args{
urlPath: "https://env_endpoint",
urlPath: "https://env_endpoint/ ",
defaultPath: "DefaultTracesPath",
},
want: "/https:/env_endpoint",
want: "/https://env_endpoint/",
},
{
name: "spaces trimmed",
Expand All @@ -639,14 +639,6 @@ func TestCleanPath(t *testing.T) {
},
want: "/dir",
},
{
name: "clean path empty",
args: args{
urlPath: "dir/..",
defaultPath: "DefaultTracesPath",
},
want: "DefaultTracesPath",
},
{
name: "make absolute",
args: args{
Expand Down
7 changes: 3 additions & 4 deletions internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ func NewHTTPConfig(opts ...HTTPOption) Config {
return cfg
}

// cleanPath returns a path with all spaces trimmed and all redundancies
// removed. If urlPath is empty or cleaning it results in an empty string,
// cleanPath returns a path with all spaces trimmed. If urlPath is empty,
// defaultPath is returned instead.
func cleanPath(urlPath string, defaultPath string) string {
tmp := path.Clean(strings.TrimSpace(urlPath))
if tmp == "." {
tmp := strings.TrimSpace(urlPath)
if tmp == "" || tmp == "." {
return defaultPath
}
if !path.IsAbs(tmp) {
Expand Down
12 changes: 2 additions & 10 deletions internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,10 @@ func TestCleanPath(t *testing.T) {
{
name: "clean traces path",
args: args{
urlPath: "https://env_endpoint",
urlPath: "https://env_endpoint/ ",
defaultPath: "DefaultTracesPath",
},
want: "/https:/env_endpoint",
want: "/https://env_endpoint/",
},
{
name: "spaces trimmed",
Expand All @@ -581,14 +581,6 @@ func TestCleanPath(t *testing.T) {
},
want: "/dir",
},
{
name: "clean path empty",
args: args{
urlPath: "dir/..",
defaultPath: "DefaultTracesPath",
},
want: "DefaultTracesPath",
},
{
name: "make absolute",
args: args{
Expand Down
Loading