Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

**Features**:

- Always emit a span usage metric, independent of span feature flags. ([#4976](https://github.com/getsentry/relay/pull/4976))

**Bug Fixes**:

- Normalize OS and Browser names in contexts when missing a version. ([#4957](https://github.com/getsentry/relay/pull/4957))
Expand Down
8 changes: 6 additions & 2 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {

let features = &project_config.features;

if !config.is_supported() || config._span_metrics_extended || !features.produces_spans() {
if !config.is_supported() || config._span_metrics_extended {
return;
}
config._span_metrics_extended = true;

// If there are any spans in the system, extract the usage metric for them:
config.metrics.push(MetricSpec {
Expand All @@ -27,6 +28,10 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
tags: vec![],
});

if !features.produces_spans() {
return;
}

config
.global_groups
.entry(GroupKey::SpanMetricsCommon)
Expand All @@ -38,7 +43,6 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
.or_default()
.is_enabled = true;

config._span_metrics_extended = true;
if config.version == 0 {
config.version = MetricExtractionConfig::MAX_SUPPORTED_VERSION;
}
Expand Down
9 changes: 8 additions & 1 deletion relay-server/src/metrics_extraction/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,14 @@ mod tests {
#[test]
fn no_feature_flags_enabled() {
let metrics = extract_span_metrics([]);
assert!(metrics.project_metrics.is_empty());

assert_eq!(metrics.project_metrics.len(), 75);
assert!(
metrics
.project_metrics
.into_iter()
.all(|x| &x.name == "c:spans/usage@none")
);

assert_eq!(metrics.sampling_metrics.len(), 1);
assert_eq!(
Expand Down
Loading