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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

**Internal**:

- Add internal attributes to aid searching trace metrics ([#5260](https://github.com/getsentry/relay/pull/5260))

## 25.10.0

**Features**:
Expand Down
16 changes: 15 additions & 1 deletion relay-server/src/processing/trace_metrics/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn attributes(
result.insert(
"sentry.metric_name".to_owned(),
AnyValue {
value: Some(any_value::Value::StringValue(metric_name)),
value: Some(any_value::Value::StringValue(metric_name.clone())),
},
);

Expand All @@ -164,6 +164,20 @@ fn attributes(
},
);

// Add key names matching metric name and type to workaround current co-occuring attributes limitations.
result.insert(
format!("sentry._internal.cooccuring.name.{metric_name}"),
AnyValue {
value: Some(any_value::Value::BoolValue(true)),
},
);
result.insert(
format!("sentry._internal.cooccuring.type.{metric_type}"),
AnyValue {
value: Some(any_value::Value::BoolValue(true)),
},
);

result.insert(
"sentry.value".to_owned(),
AnyValue {
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/test_trace_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def test_trace_metric_extraction(
"sentry.browser.version": {"stringValue": mock.ANY},
"http.method": {"stringValue": "GET"},
"http.status_code": {"intValue": "200"},
"sentry._internal.cooccuring.name.http.request.duration": {
"boolValue": True
},
"sentry._internal.cooccuring.type.distribution": {"boolValue": True},
},
"clientSampleRate": 1.0,
"downsampledRetentionDays": 390,
Expand Down Expand Up @@ -243,6 +247,8 @@ def test_trace_metric_pii_scrubbing(
"sentry._meta.fields.attributes.user.ip": {
"stringValue": '{"meta":{"value":{"":{"rem":[["strip_ips","x",0,0]],"len":11}}}}'
},
"sentry._internal.cooccuring.name.test.metric": {"boolValue": True},
"sentry._internal.cooccuring.type.counter": {"boolValue": True},
},
"clientSampleRate": 1.0,
"downsampledRetentionDays": 90,
Expand Down