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

unexpected trailing `/` appended to endpoint configured via OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

Open codeboten opened this issue 1 year ago • 1 comments

What happened?

Steps to Reproduce

Using the example code from opentelemetry.io, I tried configuring an endpoint to send data to and was receiving 404's from my backend. After digging into it, the data was being sent to https://endpoint/something/ instead of https://endpoint/something.

Expected Result

Traces sent to https://endpoint/something

Actual Result

Traces sent to https://endpoint/something/ resulting in a 404

Additional Details

Tracked the code that does the appending here: https://github.com/open-telemetry/opentelemetry-js/blob/6111ae0181474f89c9f9441a0f8a474ef3092175/experimental/packages/otlp-exporter-base/src/util.ts#L60-L63

Note that this problem does not occur if i configure the endpoint in the code instead.

OpenTelemetry Setup Code

const opentelemetry = require("@opentelemetry/sdk-node");
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node");
const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
const {
  OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-http");

const sdk = new opentelemetry.NodeSDK({
  traceExporter: new OTLPTraceExporter(),
  instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();

package.json

No response

Relevant log output

No response

codeboten avatar Sep 21 '22 17:09 codeboten

Thank you for pointing this out. I'll pick this up ASAP. :slightly_smiling_face:

pichlermarc avatar Sep 23 '22 09:09 pichlermarc