Skip to content
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

OpenTelemetry: provide a way to use (part of) the baggage as attributes #45430

Open
turing85 opened this issue Jan 7, 2025 · 3 comments
Open
Labels
area/tracing kind/enhancement New feature or request

Comments

@turing85
Copy link
Contributor

turing85 commented Jan 7, 2025

Description

When using OpenTelemetry, it can be extremely helpful to use the baggage in order to propagate information. The OpenTelemetry standard supports this idea explicitly (opentelemetry.io):

Baggage is not the same as attributes

An important thing to note about baggage is that it is a separate key-value store and is unassociated with attributes on spans, metrics, or logs without explicitly adding them.

To add baggage entries to attributes, you need to explicitly read the data from baggage and add it as attributes to your spans, metrics, or logs.

Because a common use cases for Baggage is to add data to Span Attributes across a whole trace, several languages have Baggage Span Processors that add data from baggage as attributes on span creation.

Story:

As a developer
When I want to have information across multiple signals of a span
Then I want a way to store them in the baggage, such that they are automatically added to the signal.

Implementation ideas

The simplest form would be to just add the whole baggage as attributes/metadata/.... e.g. with a common, configurable prefix (e.g. defaulting to baggage such that an baggage item foo.bar becomes attribute baggage.foo.far or metadata entry baggage.foo.bar).

A more sophisticated solution would allow to define a list of baggage items (possibly with regex-pattern) that - if present - are added as attributes/metadata/...

An additional improvement would then be to define additional overrides in form of a Lst<Map<String, String> such that the baggaea items are renamed. An entry of "foo.bar" = "baz.bag" would then rename the item from baggage.foo.bar to baz.bang (notice the missing baggage prefix).

@turing85 turing85 added the kind/enhancement New feature or request label Jan 7, 2025
Copy link

quarkus-bot bot commented Jan 7, 2025

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)

@brunobat
Copy link
Contributor

brunobat commented Jan 8, 2025

@turing85 Not sure if I read right.
You suggest a simpler way to add data to the Baggage and also include that data in the span attributes. Is this right?

@turing85
Copy link
Contributor Author

turing85 commented Jan 8, 2025

@brunobat adding data to the baggage is easy enough. The important part is an (automated) way to add (parts of) the baggage as signal metadata (attributes in traces, metadata in logs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tracing kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants