Skip to content

feat(metrics): Add before_send_metric callback#1064

Open
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/user-attributes-metricsfrom
szokeasaurusrex/before-send-metric
Open

feat(metrics): Add before_send_metric callback#1064
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/user-attributes-metricsfrom
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 9f36635

@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
Comment thread sentry-core/src/client.rs
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 added a commit that referenced this pull request Apr 23, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from d429da8 to 4ffac14 Compare April 23, 2026 20:54
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/user-attributes-metrics branch from 807de4c to 28bf132 Compare April 23, 2026 20:54
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 4ffac14 to fb0e4b4 Compare April 23, 2026 21:21
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/user-attributes-metrics branch from 28bf132 to aab78c9 Compare April 23, 2026 21:21
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 fb0e4b4 to 4cba491 Compare April 23, 2026 21:22
szokeasaurusrex added a commit that referenced this pull request Apr 23, 2026
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/before-send-metric branch from 4cba491 to 9d92d41 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/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
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
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.

2 participants