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

feat!: Add baggage key predicate func to baggage span processor #990

Merged
merged 15 commits into from
Jun 17, 2024

Conversation

MikeGoldsmith
Copy link
Member

@MikeGoldsmith MikeGoldsmith commented May 16, 2024

Which problem is this PR solving?

Short description of the changes

  • Add baggage key lambda as constructor parameter to baggage span processor
  • Add ALLOW_ALL_BAGGAGE_KEYS lambda that allows all keys
  • Add unit test to verify behaviour
  • Update README with examples of setting a filter

@MikeGoldsmith MikeGoldsmith requested review from a team May 16, 2024 11:03
@MikeGoldsmith MikeGoldsmith marked this pull request as draft May 20, 2024 14:27
@MikeGoldsmith MikeGoldsmith marked this pull request as ready for review May 21, 2024 11:02
@MikeGoldsmith MikeGoldsmith changed the title feat: Add optional predicate func to baggage span processor feat: Add baggage key predicate func to baggage span processor May 22, 2024
@MikeGoldsmith
Copy link
Member Author

Ping @robbkidd @arielvalentin - please could you take a look?

Copy link
Member

@robbkidd robbkidd left a comment

Choose a reason for hiding this comment

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

@robbkidd robbkidd changed the title feat: Add baggage key predicate func to baggage span processor feat!: Add baggage key predicate func to baggage span processor Jun 5, 2024
@robbkidd robbkidd added feature New feature or request breaking labels Jun 5, 2024
@robbkidd robbkidd force-pushed the mike/baggage-predicate branch from d241844 to f2064fe Compare June 5, 2024 21:20
@MikeGoldsmith
Copy link
Member Author

Thanks for the updates @robbkidd - much appreciated.

Copy link
Collaborator

@arielvalentin arielvalentin left a comment

Choose a reason for hiding this comment

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

Are there any cases where endusers may want to filter based on value as opposed to key alone?

If I were writing my own predicate I would likely want to reach for an implementation that uses Hash#slice and have an explicit key list as well as potentially scrub attributes that I may be concerned has PII in it. I wouldn't be able to do that with the current implementation.

Of course the more flexibility we provide, the more likely it will be a foot gun, so take my comments there with a grain of salt.

rant: wouldn't it be nice for the SDK to have the same attribute processors as the OTel collector

In addition to that, since this predicate does not get applied to the active span, should we communicate that somewhere in docs?

@MikeGoldsmith
Copy link
Member Author

Are there any cases where endusers may want to filter based on value as opposed to key alone?

If I were writing my own predicate I would likely want to reach for an implementation that uses Hash#slice and have an explicit key list as well as potentially scrub attributes that I may be concerned has PII in it. I wouldn't be able to do that with the current implementation.

Of course the more flexibility we provide, the more likely it will be a foot gun, so take my comments there with a grain of salt.

I think if you're starting to reach for a way to scrub data, your needs are more complex than what this processor offers and you should consider creating you own. I think using the key is a nice middle ground of being aware & having some control of what's going into baggage and doing more complex / custom logic.

rant: wouldn't it be nice for the SDK to have the same attribute processors as the OTel collector

Yeah, I agree it's sometimes frustrating SDKs don't have all the same processors as the Collector. Although, then we'd need to maintain them in two places.

In addition to that, since this predicate does not get applied to the active span, should we communicate that somewhere in docs?

Sure, I can madd an extra bit to the description that newly added baggage entries are not automatically added to the active span.

@arielvalentin
Copy link
Collaborator

@MikeGoldsmith please update your branch, since I do not have permissions to do so and I will merge this once specs pass.

@MikeGoldsmith
Copy link
Member Author

Done - thanks @arielvalentin 🎉

@arielvalentin arielvalentin merged commit d80a9f3 into open-telemetry:main Jun 17, 2024
54 checks passed
@MikeGoldsmith MikeGoldsmith deleted the mike/baggage-predicate branch June 17, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Baggage span processor - key predicate
4 participants