-
Notifications
You must be signed in to change notification settings - Fork 181
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
Baggage span processor - key predicate #956
Comments
I am wary of adding too much to the new processor while the proposal to add this type of functionality is still winding its way through committee. The BaggageSpanProcessor is currently simple. It's core—and really only—business logic is two lines of code: a guard and the additions. class BaggageSpanProcessor
def on_start(span, parent_context)
return unless span.respond_to?(:add_attributes) && parent_context.is_a?(::OpenTelemetry::Context)
span.add_attributes(::OpenTelemetry::Baggage.values(context: parent_context))
end
# ...
end As an alternative to adding configuration complexity to this new contrib library, developers/operators interested in customizing which keys from baggage get duplicated as attributes onto spans can add their own span processor to their applications. Something (wholly untested by me) like: module AcmeO11yWrapper
class BaggageSpanProcessor
ALLOWED_PREFIX = 'acme.'
def on_start(span, parent_context)
return unless span.respond_to?(:add_attributes) && parent_context.is_a?(::OpenTelemetry::Context)
span.add_attributes(
::OpenTelemetry::Baggage
.values(context: parent_context)
.select { |k, _v| k.start_with? ALLOWED_PREFIX }
)
end
# ...
end
end
|
I think the proposed context-scoped attributes would supersede this processor. I don't think you'd need to run both alongside each other. However, that proposal was seems to have stalled at the moment and may by some time before it accepted. The want to limit the keys that are copied is real and this enhancement helps solve the issue until context-scoped attributes are available. Agreed more work in |
👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the |
This issue is to track adding a method of selecting what baggage key entries should be copied.
Feedback in the JS contrib PR was to allow a user-provided predicate function. This puts the responsibility on the user to ensure sensitive baggage keys are not copied while also not prescribing how that is determined.
Baggage span processor - key predicate opentelemetry-js-contrib#2166
We had a similar feedback in the .NET contrib project but thought it was more complicated than just using a set of prefixes so created an issue to continue the discussion. The plain processor that copies all baggage entries (like using
*
in your example) is likely to be accepted first.The text was updated successfully, but these errors were encountered: