Closed spjmurray closed 5 months ago
Open for discussion as always! Using it is as simple as
import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
)
func foo(ctx context.Context) {
ctx = oidc.HeaderInjectClientContext(ctx, func(h http.Header) {
otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(h))
})
// Provider() or Userinfo() call
}
And it works quite nicely!
Bump. Someone, anyone? I ask not much, I promise thee! I even offer beer....
Thanks for the ping, sorry about that!
In my mind this is what accepting a custom http.Client with a custom transport is for. Go's oauth2 package does something similar to set the bearer token auth header.
Does that work for you? I imagine that strategy would avoid having to make change to other libraries as well.
Do you have examples of how other packages are supporting this?
Ah, that's how I missed it, it's not a callback but a receiver, my bad! Does make the code somewhat less legible, but that's just Go for you 😿
Okay, finally got a chance to test it out, and it works! Cheers
Use case is for tracing/performance profiling through a distributed system, in particular the W3C trace context standard used by open-telemetry.