Skip to content

feat(metrics): Add before_send_metric callback#1064

Merged
szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/before-send-metric
Apr 28, 2026
Merged

feat(metrics): Add before_send_metric callback#1064
szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/before-send-metric

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex commented Apr 16, 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.

Stacked on #1063.

Co-authored-by: Joris Bayer joris.bayer@sentry.io

Closes #1025
Closes RUST-170

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 16, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against a68455f

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from a9398ed to cf1dd39 Compare April 17, 2026 08:54
@szokeasaurusrex szokeasaurusrex changed the title feat!(metrics): Add before_send_metric callback feat(metrics): Add before_send_metric callback Apr 17, 2026
@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review April 17, 2026 08:55
@szokeasaurusrex szokeasaurusrex requested a review from lcian as a code owner April 17, 2026 08:55
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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from cf1dd39 to cdad82d Compare April 17, 2026 08:56
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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from cdad82d to 286f469 Compare April 17, 2026 08:56
szokeasaurusrex added a commit that referenced this pull request Apr 17, 2026

assert_eq!(
metric.attributes.get("added_by_callback"),
Some(&LogAttribute(Value::from("yes"))),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

szokeasaurusrex added a commit that referenced this pull request Apr 21, 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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 286f469 to 816fa87 Compare April 21, 2026 12:40
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from 948a361 to aa6f863 Compare April 21, 2026 12:41
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 816fa87 to 225d1dd Compare April 21, 2026 12:46
szokeasaurusrex added a commit that referenced this pull request Apr 21, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 21, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from aa6f863 to eece55d Compare April 21, 2026 12:47
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 225d1dd to bae243c Compare April 21, 2026 15:20
szokeasaurusrex added a commit that referenced this pull request Apr 21, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 21, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from eece55d to 787d60a Compare April 21, 2026 15:20
szokeasaurusrex added a commit that referenced this pull request Apr 22, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 22, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from bae243c to d429da8 Compare April 22, 2026 17:49
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from 787d60a to 807de4c Compare April 22, 2026 17:49
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from aab78c9 to aeedb59 Compare April 23, 2026 21:25
szokeasaurusrex added a commit that referenced this pull request Apr 23, 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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 9d92d41 to 7eb91c1 Compare April 23, 2026 21:25
szokeasaurusrex added a commit that referenced this pull request Apr 23, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 7eb91c1 to c4a07ca Compare April 24, 2026 12:37
szokeasaurusrex added a commit that referenced this pull request Apr 24, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 24, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from aeedb59 to 1d9898c Compare April 24, 2026 12:39
szokeasaurusrex added a commit that referenced this pull request Apr 24, 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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from c4a07ca to 9f36635 Compare April 24, 2026 12:42
szokeasaurusrex added a commit that referenced this pull request Apr 24, 2026
szokeasaurusrex added a commit that referenced this pull request Apr 28, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 28, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 9f36635 to fb22cb5 Compare April 28, 2026 09:22
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from 1d9898c to 98f78df Compare April 28, 2026 09:22
szokeasaurusrex added a commit that referenced this pull request Apr 28, 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)
szokeasaurusrex added a commit that referenced this pull request Apr 28, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from fb22cb5 to b18ca0a Compare April 28, 2026 12:38
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from 98f78df to a628e6f Compare April 28, 2026 12:38
szokeasaurusrex added a commit that referenced this pull request Apr 28, 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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from b18ca0a to 927c3ef Compare April 28, 2026 13:27
szokeasaurusrex added a commit that referenced this pull request Apr 28, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from a628e6f to 3c4abb6 Compare April 28, 2026 13:27
Base automatically changed from szokeasaurusrex/user-attributes-metrics to master April 28, 2026 13:50
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)
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 927c3ef to a68455f Compare April 28, 2026 13:51
szokeasaurusrex added a commit that referenced this pull request Apr 28, 2026
@szokeasaurusrex szokeasaurusrex merged commit a68455f into master Apr 28, 2026
24 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/before-send-metric branch April 28, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add before_send_metric callback processing in sentry-core

2 participants