Skip to content

bug(exporter-collector): headers are appended to existing one #2335

@niko-achilles

Description

@niko-achilles

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

"@opentelemetry/context-zone": "^0.23.0",
"@opentelemetry/exporter-collector": "^0.23.0",
"@opentelemetry/instrumentation": "^0.23.0",
"@opentelemetry/auto-instrumentations-web": "^0.23.0",
"@opentelemetry/propagator-b3": "^0.23.0",
"@opentelemetry/tracing": "^0.23.0",
"@opentelemetry/web": "^0.23.0",
"@opentelemetry/resources": "0.23.0",
"@opentelemetry/semantic-conventions": "0.23.0",

Collector docker image: otel/opentelemetry-collector-contrib:0.29.0 and/or otel/opentelemetry-collector:0.29.0

What version of Node are you using?

14 --lts : latest

Please provide the code you used to setup the OpenTelemetry SDK

https://github.com/niko-achilles/otlp-logzio-fullstack/blob/main/frontend/lib/useOpentelemetry.js#L25

What did you do?

If i provide explicitly , the content type of application/json as follows:

provider.addSpanProcessor(
    new SimpleSpanProcessor(
      new CollectorTraceExporter({
        url: "http://localhost:55681/v1/traces",
        headers: {"Content-Type": "application/json"},
      })
    )
  );

Then the zone.js script makes a request of type xhr and applies in content-type application/json twice ,
Content-type: application/json application/json

If i do not provide explicitly the Content-Type in the headers object , then
zone.js script makes a request of type xhr and applies in content-type : text/plain;charset=utf8

What did you expect to see?

content-type: application/json in the request of zone.js .

What did you see instead?

zone.js script makes a request of type xhr and applies in content-type : text/plain;charset=utf8
or
zone.js script makes a request of type xhr and applies in content-type application/json twice ,
Content-type: application/json application/json.

Additional context

If i write implicit , having the headers object as follows:

provider.addSpanProcessor(
    new SimpleSpanProcessor(
      new CollectorTraceExporter({
        url: "http://localhost:55681/v1/traces",
        headers: {},
      })
    )
  );

Then the traces are collected, because zone.js applies as content-type: application/json

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions