-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue-4687 : Add B3 trace header propagation support #513
issue-4687 : Add B3 trace header propagation support #513
Conversation
@ashutosh-narkar , can you please review and let me know your comments. |
Signed-off-by: Praneeth Talishetti <47842333+be-a-bee@users.noreply.github.com>
d6275c2
to
ada7036
Compare
@ashutosh-narkar , b3 module 1.22 required other vendor updates. I set the b3/propagators version to 1.21 and avoided other vendor updates. please check now and let me know if anything. |
ctx = metadata.AppendToOutgoingContext(ctx, "x-b3-parentspanid", "2a2b3c4d5e6f7a8b") | ||
ctx = metadata.AppendToOutgoingContext(ctx, "x-b3-traceid", exampleTraceID) | ||
ctx = metadata.AppendToOutgoingContext(ctx, "x-b3-spanid", "3f6a0b6d9d5f4b45") | ||
ctx = metadata.AppendToOutgoingContext(ctx, "x-b3-sampled", "1") | ||
ctx = metadata.AppendToOutgoingContext(ctx, "X-B3-Flags", "1") | ||
ctx = metadata.AppendToOutgoingContext(ctx, "X-B3-Baggage-User", "alice") | ||
ctx = metadata.AppendToOutgoingContext(ctx, "X-B3-Baggage-Transaction", "12345") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a reference from where these headers come from? It would helpful to add it as a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @ashutosh-narkar .
this is the reference for the b3 headers : https://github.com/openzipkin/b3-propagation?tab=readme-ov-file#overall-process
this is the reference for adding headers to a grpc request
https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md#sending-and-receiving-metadata---client-side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @be-a-bee!
Thank you @ashutosh-narkar :) |
@@ -134,11 +135,11 @@ func New(m *plugins.Manager, cfg *Config) plugins.Plugin { | |||
if m.TracerProvider() != nil { | |||
grpcTracingOption := []otelgrpc.Option{ | |||
otelgrpc.WithTracerProvider(m.TracerProvider()), | |||
otelgrpc.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})), | |||
otelgrpc.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}, b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader)))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@be-a-bee Why are we only considering B3MultipleHeader
? b3 standard also defines B3SingleHeader
Ideally, b3 propagator should be instantiated something like this
b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader | b3.B3SingleHeader))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@be-a-bee can you please address this and push an update if needed? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sarcastic-sher , I was mainly focusing on b3 trace header extraction and b3multiple header injection . Including single header injection is also important.
@ashutosh-narkar , will create a new PR for b3 single header injection as well.
add b3 propagators module and use it
add test to assert that x-b3-traceid is recognized by opa and traceid is logged in decision logs