Skip to content

feat(sentry-core): Implement trace metric capture batching#1026

Draft
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/metrics-protocolfrom
szokeasaurusrex/core-metrics-capture
Draft

feat(sentry-core): Implement trace metric capture batching#1026
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/metrics-protocolfrom
szokeasaurusrex/core-metrics-capture

Conversation

@szokeasaurusrex
Copy link
Member

Implement issue #1023 by adding the sentry-core capture path and batch lifecycle for TraceMetric.

  • Add metrics feature in sentry-core/Cargo.toml
  • Compile batcher for client + (logs|metrics)
  • Add ClientOptions::enable_metrics (default: true) and include it in Debug
  • Add Hub::capture_metric(TraceMetric)
  • Add Client metric capture with metrics_batcher lifecycle handling (clone/flush/close)
  • Add Batch impl for TraceMetric in batcher
  • Add metrics tests for disabled metrics, batch-size flush (150 -> 2 envelopes), and teardown flush

Closes #1023
Closes RUST-168
Co-authored-by: Joris Bayer joris.bayer@sentry.io

Implement issue #1023 by adding the `sentry-core` capture path and batch lifecycle for `TraceMetric`.

- Add `metrics` feature in `sentry-core/Cargo.toml`
- Compile `batcher` for `client + (logs|metrics)`
- Add `ClientOptions::enable_metrics` (default: `true`) and include it in `Debug`
- Add `Hub::capture_metric(TraceMetric)`
- Add `Client` metric capture with `metrics_batcher` lifecycle handling (`clone`/`flush`/`close`)
- Add `Batch` impl for `TraceMetric` in `batcher`
- Add metrics tests for disabled metrics, batch-size flush (150 -> 2 envelopes), and teardown flush

Closes #1023
Closes [RUST-168](https://linear.app/getsentry/issue/RUST-168/implement-trace-metric-capture-and-batching-in-sentry-core)
Co-authored-by: Joris Bayer <joris.bayer@sentry.io>
@linear-code
Copy link

linear-code bot commented Mar 5, 2026

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Implement trace metric capture batching ([#1026](https://github.com/getsentry/sentry-rust/pull/1026))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against eab9d3a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant