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

Add BaggageManager utility #908

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

NthPortal
Copy link
Contributor

Add BaggageManager utility for accessing and modifying Baggage in Local context.

Closes #896.

I know that there are law tests for Local, but I couldn't figure them out in a reasonable amount of time and I have a $work project to focus on as well. Happy for someone else to add them if desired.

I believe all these changes are backwards binary compatible with the exception of Otel4s (which gets a new abstract method to implement), but you shouldn't be implementing your own Otel4s anyway

@NthPortal NthPortal added enhancement New feature or request breaking The changes are semantically or binary breaking module:core Features and improvements to core module labels Feb 3, 2025
@NthPortal NthPortal requested a review from iRevive February 3, 2025 22:53
@mergify mergify bot added module:oteljava Features and improvements to the oteljava module module:sdk Features and improvements to the sdk module tracing Improvements to tracing module labels Feb 3, 2025
@iRevive
Copy link
Contributor

iRevive commented Feb 4, 2025

Awesome improvements, thanks!

.unsafeRunSync()

private def baggageFromContext(context: Context): Baggage =
context.get(BaggageKey).getOrElse(Baggage.empty)
Copy link
Contributor Author

@NthPortal NthPortal Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can use context.getOrElse

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, that method doesn't exist, interesting

Add `BaggageManager` utility for accessing and modifying `Baggage`
in `Local` context.
@NthPortal NthPortal merged commit 4450fc0 into typelevel:main Feb 4, 2025
11 checks passed
@NthPortal NthPortal deleted the baggage-access/PR branch February 4, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking The changes are semantically or binary breaking enhancement New feature or request module:core Features and improvements to core module module:oteljava Features and improvements to the oteljava module module:sdk Features and improvements to the sdk module tracing Improvements to tracing module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better Baggage API
2 participants