Skip to content

Commit 39aad0c

Browse files
authored
ref(metric-stats): Purges metric stats from the codebase (#5097)
You were a good feature, you were a useful feature. Unfortunately you never got to shine (rip DDM).
1 parent 4f8da3c commit 39aad0c

File tree

19 files changed

+23
-943
lines changed

19 files changed

+23
-943
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Improved PII Scrubbing for attributes / logs ([#5061](https://github.com/getsentry/relay/pull/5061)))
1919
- Introduces a project scope sampling rule type. ([#5077](https://github.com/getsentry/relay/pull/5077)))
2020
- Produce transactions on `transactions` Kafka topic, even if they have attachments. ([#5081](https://github.com/getsentry/relay/pull/5081))
21+
- Removes metric stats from the codebase. ([#5097](https://github.com/getsentry/relay/pull/5097))
2122
- Add option gating Snuba publishing to ingest-replay-events for Replays. ([#5088](https://github.com/getsentry/relay/pull/5088))
2223

2324
## 25.8.0

relay-base-schema/src/metrics/mri.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ pub enum MetricNamespace {
114114
Spans,
115115
/// User-defined metrics directly sent by SDKs and applications.
116116
Custom,
117-
/// Metric stats.
118-
///
119-
/// Metrics about metrics.
120-
Stats,
121117
/// An unknown and unsupported metric.
122118
///
123119
/// Metrics that Relay either doesn't know or recognize the namespace of will be dropped before
@@ -132,30 +128,23 @@ pub enum MetricNamespace {
132128

133129
impl MetricNamespace {
134130
/// Returns all namespaces/variants of this enum.
135-
pub fn all() -> [Self; 6] {
131+
pub fn all() -> [Self; 5] {
136132
[
137133
Self::Sessions,
138134
Self::Transactions,
139135
Self::Spans,
140136
Self::Custom,
141-
Self::Stats,
142137
Self::Unsupported,
143138
]
144139
}
145140

146-
/// Returns `true` if metric stats are enabled for this namespace.
147-
pub fn has_metric_stats(&self) -> bool {
148-
matches!(self, Self::Custom)
149-
}
150-
151141
/// Returns the string representation for this metric type.
152142
pub fn as_str(&self) -> &'static str {
153143
match self {
154144
Self::Sessions => "sessions",
155145
Self::Transactions => "transactions",
156146
Self::Spans => "spans",
157147
Self::Custom => "custom",
158-
Self::Stats => "metric_stats",
159148
Self::Unsupported => "unsupported",
160149
}
161150
}
@@ -170,7 +159,6 @@ impl std::str::FromStr for MetricNamespace {
170159
"transactions" => Ok(Self::Transactions),
171160
"spans" => Ok(Self::Spans),
172161
"custom" => Ok(Self::Custom),
173-
"metric_stats" => Ok(Self::Stats),
174162
_ => Ok(Self::Unsupported),
175163
}
176164
}

relay-cogs/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ pub enum AppFeature {
178178
MetricsSessions,
179179
/// Metrics in the custom namespace.
180180
MetricsCustom,
181-
/// Metrics in the `metric_stats` namespace.
182-
MetricsStats,
183181
/// Metrics in the unsupported namespace.
184182
///
185183
/// This is usually not emitted, since metrics in the unsupported
@@ -206,7 +204,6 @@ impl AppFeature {
206204
Self::MetricsSpans => "metrics_spans",
207205
Self::MetricsSessions => "metrics_sessions",
208206
Self::MetricsCustom => "metrics_custom",
209-
Self::MetricsStats => "metrics_metric_stats",
210207
Self::MetricsUnsupported => "metrics_unsupported",
211208
Self::Profiles => "profiles",
212209
}

relay-config/src/config.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -575,23 +575,6 @@ impl Default for Metrics {
575575
}
576576
}
577577

578-
/// Controls processing of Sentry metrics and metric metadata.
579-
#[derive(Serialize, Deserialize, Debug, Default)]
580-
#[serde(default)]
581-
pub struct SentryMetrics {
582-
/// Whether metric stats are collected and emitted.
583-
///
584-
/// Metric stats are always collected and emitted when processing
585-
/// is enabled.
586-
///
587-
/// This option is required for running multiple trusted Relays in a chain
588-
/// and you want the metric stats to be collected and forwarded from
589-
/// the first Relay in the chain.
590-
///
591-
/// Defaults to `false`.
592-
pub metric_stats_enabled: bool,
593-
}
594-
595578
/// Controls various limits
596579
#[derive(Serialize, Deserialize, Debug)]
597580
#[serde(default)]
@@ -1612,8 +1595,6 @@ struct ConfigValues {
16121595
#[serde(default)]
16131596
metrics: Metrics,
16141597
#[serde(default)]
1615-
sentry_metrics: SentryMetrics,
1616-
#[serde(default)]
16171598
sentry: relay_log::SentryConfig,
16181599
#[serde(default)]
16191600
processing: Processing,
@@ -2365,14 +2346,6 @@ impl Config {
23652346
self.values.limits.max_metric_buckets_size.as_bytes()
23662347
}
23672348

2368-
/// Whether metric stats are collected and emitted.
2369-
///
2370-
/// Metric stats are always collected and emitted when processing
2371-
/// is enabled.
2372-
pub fn metric_stats_enabled(&self) -> bool {
2373-
self.values.sentry_metrics.metric_stats_enabled || self.values.processing.enabled
2374-
}
2375-
23762349
/// Returns the maximum payload size for general API requests.
23772350
pub fn max_api_payload_size(&self) -> usize {
23782351
self.values.limits.max_api_payload_size.as_bytes()

relay-dynamic-config/src/global.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,6 @@ pub struct Options {
147147
)]
148148
pub metric_bucket_dist_encodings: BucketEncodings,
149149

150-
/// Rollout rate for metric stats.
151-
///
152-
/// Rate needs to be between `0.0` and `1.0`.
153-
/// If set to `1.0` all organizations will have metric stats enabled.
154-
#[serde(
155-
rename = "relay.metric-stats.rollout-rate",
156-
deserialize_with = "default_on_error",
157-
skip_serializing_if = "is_default"
158-
)]
159-
pub metric_stats_rollout_rate: f32,
160-
161150
/// Overall sampling of span extraction.
162151
///
163152
/// This number represents the fraction of transactions for which
@@ -220,7 +209,6 @@ pub struct BucketEncodings {
220209
spans: BucketEncoding,
221210
profiles: BucketEncoding,
222211
custom: BucketEncoding,
223-
metric_stats: BucketEncoding,
224212
}
225213

226214
impl BucketEncodings {
@@ -230,7 +218,6 @@ impl BucketEncodings {
230218
MetricNamespace::Transactions => self.transactions,
231219
MetricNamespace::Spans => self.spans,
232220
MetricNamespace::Custom => self.custom,
233-
MetricNamespace::Stats => self.metric_stats,
234221
// Always force the legacy encoding for sessions,
235222
// sessions are not part of the generic metrics platform with different
236223
// consumer which are not (yet) updated to support the new data.
@@ -266,7 +253,6 @@ where
266253
spans: encoding,
267254
profiles: encoding,
268255
custom: encoding,
269-
metric_stats: encoding,
270256
})
271257
}
272258

@@ -470,7 +456,6 @@ mod tests {
470456
spans: BucketEncoding::Legacy,
471457
profiles: BucketEncoding::Legacy,
472458
custom: BucketEncoding::Legacy,
473-
metric_stats: BucketEncoding::Legacy,
474459
}
475460
);
476461
assert_eq!(
@@ -480,7 +465,6 @@ mod tests {
480465
spans: BucketEncoding::Zstd,
481466
profiles: BucketEncoding::Zstd,
482467
custom: BucketEncoding::Zstd,
483-
metric_stats: BucketEncoding::Zstd,
484468
}
485469
);
486470
}
@@ -492,7 +476,6 @@ mod tests {
492476
spans: BucketEncoding::Zstd,
493477
profiles: BucketEncoding::Base64,
494478
custom: BucketEncoding::Zstd,
495-
metric_stats: BucketEncoding::Base64,
496479
};
497480
let s = serde_json::to_string(&original).unwrap();
498481
let s = format!(

relay-metrics/src/cogs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fn to_app_feature(ns: MetricNamespace) -> AppFeature {
4141
MetricNamespace::Transactions => AppFeature::MetricsTransactions,
4242
MetricNamespace::Spans => AppFeature::MetricsSpans,
4343
MetricNamespace::Custom => AppFeature::MetricsCustom,
44-
MetricNamespace::Stats => AppFeature::MetricsStats,
4544
MetricNamespace::Unsupported => AppFeature::MetricsUnsupported,
4645
}
4746
}

relay-metrics/src/utils.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ pub struct ByNamespace<T> {
2323
pub spans: T,
2424
/// Value for the [`MetricNamespace::Custom`] namespace.
2525
pub custom: T,
26-
/// Value for the [`MetricNamespace::Stats`] namespace.
27-
pub stats: T,
2826
/// Value for the [`MetricNamespace::Unsupported`] namespace.
2927
pub unsupported: T,
3028
}
@@ -37,7 +35,6 @@ impl<T> ByNamespace<T> {
3735
MetricNamespace::Transactions => &self.transactions,
3836
MetricNamespace::Spans => &self.spans,
3937
MetricNamespace::Custom => &self.custom,
40-
MetricNamespace::Stats => &self.stats,
4138
MetricNamespace::Unsupported => &self.unsupported,
4239
}
4340
}
@@ -49,23 +46,21 @@ impl<T> ByNamespace<T> {
4946
MetricNamespace::Transactions => &mut self.transactions,
5047
MetricNamespace::Spans => &mut self.spans,
5148
MetricNamespace::Custom => &mut self.custom,
52-
MetricNamespace::Stats => &mut self.stats,
5349
MetricNamespace::Unsupported => &mut self.unsupported,
5450
}
5551
}
5652
}
5753

5854
impl<T> IntoIterator for ByNamespace<T> {
5955
type Item = (MetricNamespace, T);
60-
type IntoIter = std::array::IntoIter<(MetricNamespace, T), 6>;
56+
type IntoIter = std::array::IntoIter<(MetricNamespace, T), 5>;
6157

6258
fn into_iter(self) -> Self::IntoIter {
6359
let Self {
6460
sessions,
6561
transactions,
6662
spans,
6763
custom,
68-
stats,
6964
unsupported,
7065
} = self;
7166

@@ -74,7 +69,6 @@ impl<T> IntoIterator for ByNamespace<T> {
7469
(MetricNamespace::Transactions, transactions),
7570
(MetricNamespace::Spans, spans),
7671
(MetricNamespace::Custom, custom),
77-
(MetricNamespace::Stats, stats),
7872
(MetricNamespace::Unsupported, unsupported),
7973
]
8074
.into_iter()
@@ -118,15 +112,13 @@ macro_rules! impl_op {
118112
transactions,
119113
spans,
120114
custom,
121-
stats,
122115
unsupported,
123116
} = self;
124117

125118
$op::$opfn(sessions, rhs.sessions);
126119
$op::$opfn(transactions, rhs.transactions);
127120
$op::$opfn(spans, rhs.spans);
128121
$op::$opfn(custom, rhs.custom);
129-
$op::$opfn(stats, rhs.stats);
130122
$op::$opfn(unsupported, rhs.unsupported);
131123
}
132124
}

0 commit comments

Comments
 (0)