Context and Baggage API usage #701
Replies: 2 comments 1 reply
-
|
@arielvalentin your example is idiomatic given the current API. The Baggage::Manager helps to manipulate baggage in a context, and then the Context API is used to activate / deactivate a given context instance. Also, given that you are starting to look at using baggage, you might have some opinions on #703. |
Beta Was this translation helpful? Give feedback.
-
|
I almost feel like it would look more idiomatic if it read as: updated_context = OpenTelemetry.baggage.merge do |context|
context.set_value(key_a: "foo")
context.set_value(key_b: "bar")
end...primarily since |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am interested in taking in using the Context and Baggage API in our applications however I want to ensure I am doing so in an idiomatic way.
I can see that the API provides utility methods like
OpenTelemetry::Context.with_currentthat changes theimplicitreference inOpenTelemetry::Context.current.The
OpenTelemetry::Baggage::Manageralso generates a new instance of theOpenTelemetry::Contextthat has a newly populated baggage entry, defaulting to using theimplicitcontext. e.g.OpenTelemetry::Baggage::Manager#buildI also see examples in auto-instrumented libraries that set the
implicitscope usingOpenTelemetry::Context.with_value, but haven't seen any used forBaggagejust yet.Would this be the idiomatic way to do so?
Beta Was this translation helpful? Give feedback.
All reactions