MetinSeylan / Nestjs-OpenTelemetry

🔭 Deeply Integrated and Auto Instrumented OpenTelemetry module for NestJS
360 stars 42 forks source link

Interceptor and Filter implementation considerations #2

Closed mentos1386 closed 2 years ago

mentos1386 commented 3 years ago

Looking at Interceptor and Filter implementation. I have couple considerations.

  1. @opentelemetry/instrumentation-http and @opentelemetry/instrumentation-grpc handle "get trace id from header" and "set trace id to header" automatically. So for http/grpc/graphql there is already existing instrumentation that handles this. Which means that "interceptor" shouldn't be needed.
  2. For Filter, there is the same idea as 1, it's already being handled by the other instrumentation and we shouldn't re-implement that logic for NestJS.
  3. Both Interceptor and Filter currently have hard-coded support only for b3 style headers. Which breaks usage for AWS X-Ray (as an example). Same as 1 and 2, this is not something that should be handled by this library but by propagators whose only job is to extract/inject trace id's from/to headers. As is the case for b3 in @opentelemetry/propagator-b3. This library should work regardless of what propagator is used.
pragmaticivan commented 3 years ago

@MetinSeylan, Thoughts on taking those considerations? After reviewing and using that in my current context they make sense. Plus, there are some push towards https://www.w3.org/TR/trace-context/