- Notifications
You must be signed in to change notification settings - Fork 133
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Prerequisites
- I have searched issues to ensure it has not already been reported
Description
In the current implementation of OpenTelemetryProducerEventsHandler.OnProducerStarted, the code replaces Baggage.Current with the baggage from the newly created Activity.
This means if there was already baggage in Baggage.Current and the new Activity doesn’t have any baggage (or only a subset), the existing values are lost.
According to the OpenTelemetry specification for baggage propagation, baggage should flow with the context and should not be unintentionally discarded. Values from the new activity should be integrated into the current context, not overwrite it entirely.
Steps to reproduce
- Set a key/value into Baggage.Current.
- Start a Producer that creates a new activity without baggage.
- Observe that Baggage.Current is reset and previous entries are lost.
Expected behavior
- Existing Baggage.Current entries should be preserved.
- Values coming from Activity.Baggage should be added or overwrite if the same key already exists.
- Context should consistently propagate across producer boundaries.
Actual behavior
Currently, when a producer activity is started, the implementation overwrites the current baggage with the contents of Activity.Baggage.
- If Activity.Baggage is empty, Baggage.Current is effectively cleared.
- Any previously set context in Baggage.Current is lost and does not propagate further.
- This leads to missing baggage values in downstream services whenever the newly created Activity does not carry its own baggage (for example, when Activity.Recorded = false).
KafkaFlow version
4.0.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working