Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## Unreleased


**Bug fixes:**

- Respect country code TLDs when scrubbing span tags. ([#3458](https://github.com/getsentry/relay/pull/3458))
Expand All @@ -11,6 +10,7 @@

- Use same keys for OTel span attributes and Sentry span data. ([#3457](https://github.com/getsentry/relay/pull/3457))
- Support passing owner when upserting Monitors. ([#3468](https://github.com/getsentry/relay/pull/3468))
- Extract `frames.slow`, `frames.frozen`, and `frames.total` metrics from mobile spans. ([#3473](https://github.com/getsentry/relay/pull/3473))

**Internal**:

Expand Down
96 changes: 96 additions & 0 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,102 @@ fn span_metrics(
.always(), // already guarded by condition on metric
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:spans/mobile.slow_frames@none".into(),
field: Some("span.data.frames\\.slow".into()),
condition: Some(is_mobile.clone() & duration_condition.clone()),
tags: vec![
Tag::with_key("transaction")
.from_field("span.sentry_tags.transaction")
.always(),
Tag::with_key("environment")
.from_field("span.sentry_tags.environment")
.always(),
Tag::with_key("release")
.from_field("span.sentry_tags.release")
.always(),
Tag::with_key("span.description")
.from_field("span.sentry_tags.description")
.always(),
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
Tag::with_key("span.group")
.from_field("span.sentry_tags.group")
.always(),
Tag::with_key("device.class")
.from_field("span.sentry_tags.device.class")
.always(),
Tag::with_key("os.name")
.from_field("span.sentry_tags.os.name")
.always(),
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:spans/mobile.frozen_frames@none".into(),
field: Some("span.data.frames\\.frozen".into()),
condition: Some(is_mobile.clone() & duration_condition.clone()),
tags: vec![
Tag::with_key("transaction")
.from_field("span.sentry_tags.transaction")
.always(),
Tag::with_key("environment")
.from_field("span.sentry_tags.environment")
.always(),
Tag::with_key("release")
.from_field("span.sentry_tags.release")
.always(),
Tag::with_key("span.description")
.from_field("span.sentry_tags.description")
.always(),
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
Tag::with_key("span.group")
.from_field("span.sentry_tags.group")
.always(),
Tag::with_key("device.class")
.from_field("span.sentry_tags.device.class")
.always(),
Tag::with_key("os.name")
.from_field("span.sentry_tags.os.name")
.always(),
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:spans/mobile.total_frames@none".into(),
field: Some("span.data.frames\\.total".into()),
condition: Some(is_mobile.clone() & duration_condition.clone()),
tags: vec![
Tag::with_key("transaction")
.from_field("span.sentry_tags.transaction")
.always(),
Tag::with_key("environment")
.from_field("span.sentry_tags.environment")
.always(),
Tag::with_key("release")
.from_field("span.sentry_tags.release")
.always(),
Tag::with_key("span.description")
.from_field("span.sentry_tags.description")
.always(),
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
Tag::with_key("span.group")
.from_field("span.sentry_tags.group")
.always(),
Tag::with_key("device.class")
.from_field("span.sentry_tags.device.class")
.always(),
Tag::with_key("os.name")
.from_field("span.sentry_tags.os.name")
.always(),
],
},
];

if double_write_distributions_as_gauges {
Expand Down
29 changes: 28 additions & 1 deletion relay-event-schema/src/protocol/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ pub struct SpanData {
#[metastructure(field = "sentry.sdk.name")]
pub sdk_name: Annotated<String>,

/// Slow Frames
#[metastructure(field = "frames.slow")]
pub frames_slow: Annotated<Value>,

/// Frozen Frames
#[metastructure(field = "frames.frozen")]
pub frames_frozen: Annotated<Value>,

/// Total Frames
#[metastructure(field = "frames.total")]
pub frames_total: Annotated<Value>,

/// Other fields in `span.data`.
#[metastructure(additional_properties, pii = "true", retain = "true")]
other: Object<Value>,
Expand All @@ -316,6 +328,9 @@ impl Getter for SpanData {
"db.operation" => self.db_operation.value()?.into(),
"db\\.system" => self.db_system.value()?.into(),
"environment" => self.environment.as_str()?.into(),
"frames\\.frozen" => self.frames_frozen.value()?.into(),
"frames\\.slow" => self.frames_slow.value()?.into(),
"frames\\.total" => self.frames_total.value()?.into(),
"http\\.decoded_response_content_length" => {
self.http_decoded_response_content_length.value()?.into()
}
Expand Down Expand Up @@ -493,7 +508,10 @@ mod tests {
"code.filepath": "task.py",
"code.lineno": 123,
"code.function": "fn()",
"code.namespace": "ns"
"code.namespace": "ns",
"frames.slow": 1,
"frames.frozen": 2,
"frames.total": 9
}"#;
let data = Annotated::<SpanData>::from_json(data)
.unwrap()
Expand Down Expand Up @@ -542,6 +560,15 @@ mod tests {
user: ~,
replay_id: ~,
sdk_name: ~,
frames_slow: I64(
1,
),
frames_frozen: I64(
2,
),
frames_total: I64(
9,
),
other: {
"bar": String(
"3",
Expand Down
3 changes: 3 additions & 0 deletions relay-event-schema/src/protocol/span/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ mod tests {
user: ~,
replay_id: ~,
sdk_name: "sentry.php",
frames_slow: ~,
frames_frozen: ~,
frames_total: ~,
other: {},
},
sentry_tags: ~,
Expand Down
7 changes: 6 additions & 1 deletion relay-server/src/metrics_extraction/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,12 @@ mod tests {
"span_id": "bd429c44b67a3eb2",
"start_timestamp": 1597976300.0000000,
"timestamp": 1597976303.0000000,
"trace_id": "ff62a8b040f340bda5d830223def1d81"
"trace_id": "ff62a8b040f340bda5d830223def1d81",
"data": {
"frames.slow": 1,
"frames.frozen": 2,
"frames.total": 9
}
},
{
"op": "app.start.cold",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,49 @@ expression: "(&event.value().unwrap().spans, metrics)"
tags: ~,
origin: ~,
profile_id: ~,
data: ~,
data: SpanData {
app_start_type: ~,
browser_name: ~,
code_filepath: ~,
code_lineno: ~,
code_function: ~,
code_namespace: ~,
db_operation: ~,
db_system: ~,
environment: ~,
release: ~,
http_decoded_response_content_length: ~,
http_request_method: ~,
http_response_content_length: ~,
http_response_transfer_size: ~,
resource_render_blocking_status: ~,
server_address: ~,
cache_hit: ~,
cache_item_size: ~,
http_response_status_code: ~,
ai_input_messages: ~,
ai_completion_tokens_used: ~,
ai_prompt_tokens_used: ~,
ai_total_tokens_used: ~,
ai_responses: ~,
thread_name: ~,
segment_name: ~,
ui_component_name: ~,
url_scheme: ~,
user: ~,
replay_id: ~,
sdk_name: ~,
frames_slow: I64(
1,
),
frames_frozen: I64(
2,
),
frames_total: I64(
9,
),
other: {},
},
sentry_tags: {
"app_start_type": "warm",
"device.class": "1",
Expand Down Expand Up @@ -345,6 +387,9 @@ expression: "(&event.value().unwrap().spans, metrics)"
user: ~,
replay_id: ~,
sdk_name: ~,
frames_slow: ~,
frames_frozen: ~,
frames_total: ~,
other: {},
},
sentry_tags: {
Expand Down Expand Up @@ -428,6 +473,9 @@ expression: "(&event.value().unwrap().spans, metrics)"
user: ~,
replay_id: ~,
sdk_name: ~,
frames_slow: ~,
frames_frozen: ~,
frames_total: ~,
other: {},
},
sentry_tags: {
Expand Down Expand Up @@ -715,6 +763,72 @@ expression: "(&event.value().unwrap().spans, metrics)"
merges: 1,
},
},
Bucket {
timestamp: UnixTimestamp(1597976303),
width: 0,
name: MetricName(
"d:spans/mobile.slow_frames@none",
),
value: Distribution(
[
1.0,
],
),
tags: {
"device.class": "1",
"os.name": "iOS",
"release": "1.2.3",
"span.op": "ui.load.initial_display",
"transaction": "gEt /api/:version/users/",
},
metadata: BucketMetadata {
merges: 1,
},
},
Bucket {
timestamp: UnixTimestamp(1597976303),
width: 0,
name: MetricName(
"d:spans/mobile.frozen_frames@none",
),
value: Distribution(
[
2.0,
],
),
tags: {
"device.class": "1",
"os.name": "iOS",
"release": "1.2.3",
"span.op": "ui.load.initial_display",
"transaction": "gEt /api/:version/users/",
},
metadata: BucketMetadata {
merges: 1,
},
},
Bucket {
timestamp: UnixTimestamp(1597976303),
width: 0,
name: MetricName(
"d:spans/mobile.total_frames@none",
),
value: Distribution(
[
9.0,
],
),
tags: {
"device.class": "1",
"os.name": "iOS",
"release": "1.2.3",
"span.op": "ui.load.initial_display",
"transaction": "gEt /api/:version/users/",
},
metadata: BucketMetadata {
merges: 1,
},
},
Bucket {
timestamp: UnixTimestamp(1597976303),
width: 0,
Expand Down