go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

Add Baggage Support

Open cicoyle opened this issue 8 months ago • 4 comments

The Dapr runtime has recently added support for baggage propagation. Here is the docs PR for reference as well. Baggage is a mechanism to propagate key-value pairs across service boundaries, which is useful for passing contextual information through distributed traces.

We should add a new function that users can use to add baggage propagation support, working for both gRPC and HTTP. This would enable users to provide baggage without having to import OpenTelemetry themselves.

consumer code example:

ctx = client.WithBaggage(ctx, map[string]string{
    "user-id": "12345",
    "tenant": "acme",
})

client.InvokeMethod(ctx, ...)

We should have tests for both gRPC + HTTP for this functionality.

cicoyle avatar Apr 09 '25 19:04 cicoyle

Hey @cicoyle . I would like to take this up if it's still open and looking for contributions!

PrinsonF77 avatar Apr 17 '25 19:04 PrinsonF77

@PrinsonF77 feel free to comment on this issue with /assign to assign it to yourself. It's definitely up for grabs :)

cicoyle avatar Jun 05 '25 03:06 cicoyle

/assign

PrinsonF77 avatar Jun 09 '25 17:06 PrinsonF77

@cicoyle I have raise a work in progress PR. The original issue mentioned adding baggage support to the HTTP client as well. But I could only find the GRPC Client being returned when NewClient is called. Please let me know if I have missed something as to how the HTTP client is initialized so I could make those changes as well. Thank you!

PrinsonF77 avatar Jun 10 '25 07:06 PrinsonF77