opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

fix(exporters): do not append trailing '/' when URL contains path

Open pichlermarc opened this issue 1 year ago • 1 comments

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

pichlermarc avatar Sep 23 '22 09:09 pichlermarc

Codecov Report

Merging #3274 (5c92d23) into main (e91cac5) will decrease coverage by 0.01%. The diff coverage is 84.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%> (ø)

codecov[bot] avatar Sep 23 '22 09:09 codecov[bot]

Good catch. Thanks for fixing it! 😀

svetlanabrennan avatar Sep 27 '22 21:09 svetlanabrennan