Skip to content

otlpmetricgrpc: preserve gRPC env endpoint targets - #8862

Open
RedZapdos123 wants to merge 5 commits into
open-telemetry:mainfrom
RedZapdos123:fix-otlpmetricgrpc-env-endpoint-path
Open

otlpmetricgrpc: preserve gRPC env endpoint targets#8862
RedZapdos123 wants to merge 5 commits into
open-telemetry:mainfrom
RedZapdos123:fix-otlpmetricgrpc-env-endpoint-path

Conversation

@RedZapdos123

@RedZapdos123 RedZapdos123 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description:

Issue #8861 reported that OTEL_EXPORTER_OTLP_METRICS_ENDPOINT URLs with a path could leak that path into the OTLP/gRPC dial target because the env config built the target with path.Join(u.Host, u.Path).

This PR updates OTLP metric env endpoint handling to use only host:port for HTTP(S) URLs while preserving full unix:// and unix-abstract:// gRPC targets.

It also adds regression tests that cover URL endpoints with paths and unix-family endpoints in the metric exporter env config paths.

Closes #8861.

Verifications:

  • cd exporters/otlp/otlpmetric/otlpmetricgrpc && go test ./... -count=1
  • cd exporters/otlp/otlpmetric/otlpmetrichttp && go test ./... -count=1
  • make golangci-lint/./exporters/otlp/otlpmetric/otlpmetricgrpc
  • make golangci-lint/./exporters/otlp/otlpmetric/otlpmetrichttp

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.4%. Comparing base (1ad6638) to head (c70787b).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8862   +/-   ##
=====================================
  Coverage   88.4%   88.4%           
=====================================
  Files        331     331           
  Lines      21001   21009    +8     
=====================================
+ Hits       18572   18582   +10     
+ Misses      2429    2427    -2     
Files with missing lines Coverage Δ
...pmetric/otlpmetricgrpc/internal/oconf/envconfig.go 95.7% <100.0%> (+0.1%) ⬆️
...pmetric/otlpmetrichttp/internal/oconf/envconfig.go 95.7% <100.0%> (+0.1%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
@RedZapdos123

Copy link
Copy Markdown
Contributor Author

Resolved the merge conflict.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
…env-endpoint-path

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>

# Conflicts:
#	CHANGELOG.md
@MrAlias MrAlias added this to the v1.47.0 milestone Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

otlpmetricgrpc: error setting OTEL_EXPORTER_OTLP_METRICS_ENDPOINT with a path

2 participants