opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

In `io.opentelemetry.instrumentation.grpc.v1_6` the Setter duplicates instead of replacing

Open cleverchuk opened this issue 10 months ago • 0 comments

Describe the bug

In this code block the carrier happens to be implemented as a multi-value map. This makes adding the same key with new value a none replacing operation. This behavior will cause the metadata transported across multiple services to keep growing as they update the traceparent or tracestate or any key.

Steps to reproduce

Setup three grpc service that communicate in linear fashion i.e A -> B -> C each instrumented with the agent. Log the carrier to console.

Expected behavior

For example if the agent is updating tracestate with the name of the service then the metadata log line in each service should like A: [tracestate=name=A] B: [tracestate=name=B] C: [tracestate=name=C]

Actual behavior

A: [tracestate=name=A] B: [tracestate=name=B, tracestate=name=A] C: [tracestate=name=C, tracestate=name=B, tracestate=name=A]

Javaagent or library instrumentation version

v2.3.0

Environment

JDK: openjdk:17 OS: MacOS 14.4.1

Additional context

No response

cleverchuk avatar Apr 26 '24 14:04 cleverchuk