feat(metrics): Add before_send_metric callback#1064
Open
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/user-attributes-metricsfrom
Open
feat(metrics): Add before_send_metric callback#1064szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/user-attributes-metricsfrom
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/user-attributes-metricsfrom
Conversation
|
a9398ed to
cf1dd39
Compare
szokeasaurusrex
added a commit
that referenced
this pull request
Apr 17, 2026
Run metrics through `ClientOptions::before_send_metric` after scope/default attribute enrichment and before enqueue so applications can filter or mutate metrics before batching. Co-authored-by: Joris Bayer <joris.bayer@sentry.io> Closes #1025 Closes [RUST-170](https://linear.app/getsentry/issue/RUST-170/add-before-send-metric-callback-processing-in-sentry-core)
cf1dd39 to
cdad82d
Compare
Run metrics through `ClientOptions::before_send_metric` after scope/default attribute enrichment and before enqueue so applications can filter or mutate metrics before batching. Co-authored-by: Joris Bayer <joris.bayer@sentry.io> Closes #1025 Closes [RUST-170](https://linear.app/getsentry/issue/RUST-170/add-before-send-metric-callback-processing-in-sentry-core)
cdad82d to
286f469
Compare
szokeasaurusrex
added a commit
that referenced
this pull request
Apr 17, 2026
Stacked on #1064 Closes #1011 Closes [RUST-161](https://linear.app/getsentry/issue/RUST-161/add-trace-metric-rate-limiting-behavior-for-transport) Co-Authored-By: Joris Bayer <joris.bayer@sentry.io>
lcian
reviewed
Apr 17, 2026
|
|
||
| assert_eq!( | ||
| metric.attributes.get("added_by_callback"), | ||
| Some(&LogAttribute(Value::from("yes"))), |
Member
There was a problem hiding this comment.
Did we intend to call this just Attribute (could either be a new type or just a type alias)? I don't remember what was the outcome of that discussion (if any).
Member
Author
There was a problem hiding this comment.
Yeah, I think it makes sense to make that change. Likely we should do it as a type alias (rename LogAttribute to Attribute, and make LogAttribute an alias to Attribute). However, I believe we can also do this later, should be a backwards and forwards-compatible change as far as I am aware
lcian
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run metrics through
ClientOptions::before_send_metricafter scope/default attribute enrichment and before enqueue so applications can filter or mutate metrics before batching.Co-authored-by: Joris Bayer joris.bayer@sentry.io
Closes #1025
Closes RUST-170