You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common pattern in instrumentations is to retrieve a Tracer almost every time a span is created, this is not the pattern we want to encourage, and we should change this ASAP to avoid other copying this pattern.
I think there's a third way that should be what we recommend. The net/http instrumentation will use a single Tracer instance if a TracerProvider was provided at configuration time, but otherwise will attempt to extract a TracerProvider from the active span and then fall back to the global TracerProvider if there is no active span. This allows for simplified use in multi-tenant scenarios where multiple TracerProviders may be in use while allowing those without that requirement to ensure only one Tracer is ever constructed.
If the fallback to global TraceProvider, also we should optimize to not call global.TraceProvider().Get(...) every request. You may actually want to provide a mini library for all the logic.
A common pattern in instrumentations is to retrieve a Tracer almost every time a span is created, this is not the pattern we want to encourage, and we should change this ASAP to avoid other copying this pattern.
See some examples:
The person who is going to work on this should find all these patterns and fix.
The text was updated successfully, but these errors were encountered: