diff --git a/CHANGELOG.md b/CHANGELOG.md index 49138605f63..5468965ec92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ **Internal**: - Emit outcomes for skipped large attachments on playstation crashes. ([#4862](https://github.com/getsentry/relay/pull/4862)) -- Disable span metrics. ([#4931](https://github.com/getsentry/relay/pull/4931)) +- Disable span metrics. ([#4931](https://github.com/getsentry/relay/pull/4931),[#4955](https://github.com/getsentry/relay/pull/4955)) ## 25.7.0 diff --git a/relay-dynamic-config/src/defaults.rs b/relay-dynamic-config/src/defaults.rs index 937b531e489..a9cb4355424 100644 --- a/relay-dynamic-config/src/defaults.rs +++ b/relay-dynamic-config/src/defaults.rs @@ -12,28 +12,31 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) { .metric_extraction .get_or_insert_with(MetricExtractionConfig::empty); - if !config.is_supported() || config._span_metrics_extended { + let features = &project_config.features; + + if !config.is_supported() || config._span_metrics_extended || !features.produces_spans() { return; } - let features = &project_config.features; - // If there are any spans in the system, extract the usage metric for them: - if features.produces_spans() { - config.metrics.push(MetricSpec { - category: DataCategory::Span, - mri: "c:spans/usage@none".into(), - field: None, - condition: None, - tags: vec![], - }); - } + config.metrics.push(MetricSpec { + category: DataCategory::Span, + mri: "c:spans/usage@none".into(), + field: None, + condition: None, + tags: vec![], + }); - let span_metrics_tx = config + config + .global_groups + .entry(GroupKey::SpanMetricsCommon) + .or_default() + .is_enabled = true; + config .global_groups .entry(GroupKey::SpanMetricsTx) - .or_default(); - span_metrics_tx.is_enabled = true; + .or_default() + .is_enabled = true; config._span_metrics_extended = true; if config.version == 0 { @@ -63,72 +66,13 @@ pub fn hardcoded_span_metrics() -> Vec<(GroupKey, Vec, Vec Vec<(GroupKey, Vec, Vec