Skip to content

feat: Send trace metrics to Sentry#5647

Draft
jjbayer wants to merge 4 commits intomasterfrom
joris/trace-metrics
Draft

feat: Send trace metrics to Sentry#5647
jjbayer wants to merge 4 commits intomasterfrom
joris/trace-metrics

Conversation

@jjbayer
Copy link
Member

@jjbayer jjbayer commented Feb 19, 2026

No description provided.

jjbayer and others added 4 commits February 17, 2026 16:19
Switch sentry-rust dependency to the `feat/trace-metrics` branch which
adds trace metrics support. Add a `trace_sample_rate` config option
(default 0.0) that controls what fraction of relay-statsd metrics are
also sent to Sentry as trace metrics via the new `metrics_count`,
`metrics_gauge`, and `metrics_distribution` APIs.

The double-write is feature-gated behind `sentry-metrics` on relay-statsd,
with a no-op fallback when disabled. Counters, gauges, distributions, and
timers are forwarded; sets are skipped (no trace metrics equivalent).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eature

- Introduce TracedMetricBuilder wrapper that captures trace metadata
  (type, name, value) at construction time, eliminating redundant
  parameters in macro expansions
- Add generic build_counter/build_gauge/build_distribution methods on
  MetricsClient with IntoF64 trait for type-safe f64 conversion
- Remove sentry-metrics feature flag, compile trace metric support
  unconditionally
- Trace sample rate is the product of effective_sample_rate and
  trace_sample_rate, evaluated independently of StatsD sampling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…client_sample_rate

Adapt to the updated sentry-rust trace metrics API (getsentry/sentry-rust#997):
- Rename `metrics.trace_sample_rate` config to `metrics.send_to_sentry`
- Enable `metrics_enabled` on the Sentry SDK when `send_to_sentry > 0.0`
- Use sentry-core macros instead of removed free functions
- Set `sentry.client_sample_rate` attribute on each trace metric so
  Sentry can extrapolate from the sampled data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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

Comments