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

Implement ExtendedTextMapGetter in instrumentations

Open jamesmoessis opened this issue 11 months ago • 8 comments

Is your feature request related to a problem? Please describe.

Spec has recently changed to specify extraction of multiple values for a given key: https://github.com/open-telemetry/opentelemetry-specification/pull/4295

The Java SDK has added ExtendedTextMapGetter to handle this: https://github.com/open-telemetry/opentelemetry-java/pull/6852 (when stabilised this extension may become a default method on TextMapGetter which should be then implemented by instrumentations).

Describe the solution you'd like

For instrumentations that have carriers that support multiple values for a single key (most HTTP implementations) this should be a relatively straightforward change.

It does not necessarily need to be supported by all instrumentations.

jamesmoessis avatar Dec 10 '24 03:12 jamesmoessis

I have gone through all the instrumentations and found that the following 15 TextMapGetter need to be modified. Can I make all the changes to TextMapGetter in single PR? @trask

  • [x] io.opentelemetry.instrumentation.grpc.v1_6.GrpcRequestGetterhttps://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/13011
  • [ ] io.opentelemetry.javaagent.instrumentation.grizzly.HttpRequestHeadersGetter
  • [ ] io.opentelemetry.instrumentation.spring.webmvc.v6_0.JakartaHttpServletRequestGetter
  • [x] io.opentelemetry.instrumentation.spring.webmvc.v5_3.JavaxHttpServletRequestGetterhttps://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/13027
  • [ ] io.opentelemetry.javaagent.instrumentation.jetty.v12_0.Jetty12TextMapGetter
  • [x] io.opentelemetry.instrumentation.kafka.internal.KafkaConsumerRecordGetter
  • [ ] io.opentelemetry.javaagent.instrumentation.liberty.dispatcher.LibertyDispatcherRequestGetter
  • [ ] io.opentelemetry.instrumentation.awssdk.v2_2.internal.SqsParentContext.MessageAttributeValueMapGetter
  • [ ] io.opentelemetry.javaagent.instrumentation.netty.v3_8.server.NettyHeadersGetter
  • [ ] io.opentelemetry.instrumentation.ratpack.v1_7.internal.RatpackGetter
  • [ ] io.opentelemetry.instrumentation.restlet.v1_1.internal.RestletHeadersGetter
  • [ ] io.opentelemetry.instrumentation.restlet.v2_0.internal.RestletHeadersGetter
  • [ ] io.opentelemetry.javaagent.instrumentation.servlet.ServletRequestGetter
  • [ ] io.opentelemetry.javaagent.instrumentation.undertow.UndertowExchangeGetter
  • [ ] io.opentelemetry.instrumentation.spring.webflux.v5_3.WebfluxTextMapGetter

xiepuhuan avatar Dec 23 '24 16:12 xiepuhuan

Would this contribution be welcome? @trask

xiepuhuan avatar Jan 02 '25 03:01 xiepuhuan

hi @xiepuhuan! yes, let's start with just one (pick any), so we can work through any issues/concerns, and then you could do the rest in a single follow-up PR if you'd like to continue

trask avatar Jan 06 '25 21:01 trask

hi @xiepuhuan! yes, let's start with just one (pick any), so we can work through any issues/concerns, and then you could do the rest in a single follow-up PR if you'd like to continue

Thank you for your reply. I will try to complete the first pull request for ExtendedTextMapGetter.

xiepuhuan avatar Jan 07 '25 06:01 xiepuhuan

https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/13027 has been merged into the main branch. Next, I want to implement ExtendedTextMapGetter in all http server related instrumentations. @trask

xiepuhuan avatar Jan 15 '25 01:01 xiepuhuan

@xiepuhuan sounds great!

trask avatar Jan 15 '25 03:01 trask

#13027 has been merged into the main branch. Next, I want to implement ExtendedTextMapGetter in all http server related instrumentations.

Hope you didn't start with it as I also implemented these in https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/13053

laurit avatar Jan 16 '25 11:01 laurit

#13027 has been merged into the main branch. Next, I want to implement ExtendedTextMapGetter in all http server related instrumentations.

Hope you didn't start with it as I also implemented these in #13053

Although I have achieved some, I believe your implementation will be better. I plan to implement ExtendedTextMapGetter in the instrumentations of non http servers.

xiepuhuan avatar Jan 17 '25 02:01 xiepuhuan