opentelemetry-js
opentelemetry-js copied to clipboard
fix(exporters): do not append trailing '/' when URL contains path
Which problem is this PR solving?
When a signal specific environment variable (OTEL_EXPORTER_OTLP_<signal>_ENDPOINT
) was passed with a url that contains a path not ending in v1/traces
or v1/metrics
, a /
was unexpectedly appended.
Fixes #3269
Short description of the changes
Now parsing the URL on initialization and adding the /
only when the path is empty.
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [x] Existing unit tests
- [x] Added additional unit tests
Checklist:
- [ ] Followed the style guidelines of this project
- [ ] Unit tests have been added
- [ ] Documentation has been updated
Codecov Report
Merging #3274 (5c92d23) into main (e91cac5) will decrease coverage by
0.01%
. The diff coverage is84.61%
.
Additional details and impacted files
@@ Coverage Diff @@
## main #3274 +/- ##
==========================================
- Coverage 93.44% 93.43% -0.02%
==========================================
Files 241 241
Lines 7249 7253 +4
Branches 1507 1507
==========================================
+ Hits 6774 6777 +3
- Misses 475 476 +1
Impacted Files | Coverage Δ | |
---|---|---|
...perimental/packages/otlp-exporter-base/src/util.ts | 94.73% <77.77%> (-2.33%) |
:arrow_down: |
...e-otlp-http/src/platform/node/OTLPTraceExporter.ts | 100.00% <100.00%> (ø) |
|
...exporter-trace-otlp-proto/src/OTLPTraceExporter.ts | 100.00% <100.00%> (ø) |
|
...-otlp-http/src/platform/node/OTLPMetricExporter.ts | 100.00% <100.00%> (ø) |
|
...orter-metrics-otlp-proto/src/OTLPMetricExporter.ts | 100.00% <100.00%> (ø) |
Good catch. Thanks for fixing it! 😀