From c6d2b365866a5216bac91ba9a645992992f538eb Mon Sep 17 00:00:00 2001 From: Nar Saynorath Date: Wed, 6 Mar 2024 11:53:47 -0500 Subject: [PATCH 1/3] feat(app-start): Add process load span to mobile span ops This was added to capture the system start up portion in Android and recently merged. Add the span op to start collecting metrics on this. --- relay-dynamic-config/src/defaults.rs | 1 + relay-server/src/metrics_extraction/event.rs | 11 ++ ...t__tests__extract_span_metrics_mobile.snap | 122 ++++++++++++++++++ 3 files changed, 134 insertions(+) diff --git a/relay-dynamic-config/src/defaults.rs b/relay-dynamic-config/src/defaults.rs index 1dc1ea6b35..b8d69b0bdc 100644 --- a/relay-dynamic-config/src/defaults.rs +++ b/relay-dynamic-config/src/defaults.rs @@ -23,6 +23,7 @@ const MOBILE_OPS: &[&str] = &[ "app.*", "application.load", "contentprovider.load", + "process.load", "ui.load*", ]; diff --git a/relay-server/src/metrics_extraction/event.rs b/relay-server/src/metrics_extraction/event.rs index bfff98d4f7..345bf220dd 100644 --- a/relay-server/src/metrics_extraction/event.rs +++ b/relay-server/src/metrics_extraction/event.rs @@ -1092,6 +1092,17 @@ mod tests { "data": { "app_start_type": "cold" } + }, + { + "op": "process.load", + "description": "Process Initialization", + "span_id": "bd429c44b67a3eb2", + "start_timestamp": 1597976300.0000000, + "timestamp": 1597976303.0000000, + "trace_id": "ff62a8b040f340bda5d830223def1d81", + "data": { + "app_start_type": "cold" + } } ] } diff --git a/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap b/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap index 3665df4338..1d13a0658b 100644 --- a/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap +++ b/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap @@ -348,6 +348,69 @@ expression: "(&event.value().unwrap().spans, metrics)" platform: ~, other: {}, }, + Span { + timestamp: Timestamp( + 2020-08-21T02:18:23Z, + ), + start_timestamp: Timestamp( + 2020-08-21T02:18:20Z, + ), + exclusive_time: 3000.0, + description: "Process Initialization", + op: "process.load", + span_id: SpanId( + "bd429c44b67a3eb2", + ), + parent_span_id: ~, + trace_id: TraceId( + "ff62a8b040f340bda5d830223def1d81", + ), + segment_id: ~, + is_segment: ~, + status: ~, + tags: ~, + origin: ~, + profile_id: ~, + data: SpanData { + app_start_type: String( + "cold", + ), + browser_name: ~, + code_filepath: ~, + code_lineno: ~, + code_function: ~, + code_namespace: ~, + db_operation: ~, + db_system: ~, + environment: ~, + http_decoded_response_content_length: ~, + http_request_method: ~, + http_response_content_length: ~, + http_response_transfer_size: ~, + resource_render_blocking_status: ~, + server_address: ~, + http_response_status_code: ~, + thread_name: ~, + ui_component_name: ~, + url_scheme: ~, + other: {}, + }, + sentry_tags: { + "app_start_type": "cold", + "device.class": "1", + "mobile": "true", + "op": "process.load", + "os.name": "iOS", + "release": "1.2.3", + "transaction": "gEt /api/:version/users/", + "transaction.method": "GET", + "ttid": "ttid", + }, + received: ~, + measurements: ~, + _metrics_summary: ~, + other: {}, + }, ], [ Bucket { @@ -769,5 +832,64 @@ expression: "(&event.value().unwrap().spans, metrics)" "transaction": "gEt /api/:version/users/", }, }, + Bucket { + timestamp: UnixTimestamp(1597976303), + width: 0, + name: "d:spans/exclusive_time@millisecond", + value: Distribution( + [ + 3000.0, + ], + ), + tags: { + "app_start_type": "cold", + "device.class": "1", + "os.name": "iOS", + "release": "1.2.3", + "span.op": "process.load", + "transaction": "gEt /api/:version/users/", + "transaction.method": "GET", + "ttid": "ttid", + }, + }, + Bucket { + timestamp: UnixTimestamp(1597976303), + width: 0, + name: "d:spans/exclusive_time_light@millisecond", + value: Distribution( + [ + 3000.0, + ], + ), + tags: { + "device.class": "1", + "os.name": "iOS", + "release": "1.2.3", + "span.op": "process.load", + }, + }, + Bucket { + timestamp: UnixTimestamp(1597976303), + width: 0, + name: "c:spans/count_per_op@none", + value: Counter( + 1.0, + ), + tags: { + "span.op": "process.load", + }, + }, + Bucket { + timestamp: UnixTimestamp(1597976303), + width: 0, + name: "c:spans/count_per_segment@none", + value: Counter( + 1.0, + ), + tags: { + "release": "1.2.3", + "transaction": "gEt /api/:version/users/", + }, + }, ], ) From 4df462df302f51c087466668f2135d8dc8162102 Mon Sep 17 00:00:00 2001 From: Nar Saynorath Date: Wed, 6 Mar 2024 11:57:26 -0500 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 417453e3eb..4eecf9e7eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Parse & scrub span description for supabase. ([#3153](https://github.com/getsentry/relay/pull/3153), [#3156](https://github.com/getsentry/relay/pull/3156)) - Introduce generic filters in global configs. ([#3161](https://github.com/getsentry/relay/pull/3161)) - Individual cardinality limits can now be set into passive mode and not be enforced. ([#3199](https://github.com/getsentry/relay/pull/3199)) +- Add `process.load` span to ingested mobile span ops. ([#3227](https://github.com/getsentry/relay/pull/3227)) **Bug Fixes**: From 8d48a42d25e85d62e6755cc9c9d66852df4ebfd0 Mon Sep 17 00:00:00 2001 From: Nar Saynorath Date: Wed, 6 Mar 2024 12:55:05 -0500 Subject: [PATCH 3/3] Fix test --- relay-server/src/metrics_extraction/event.rs | 2 +- ...raction__event__tests__extract_span_metrics_mobile.snap | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/relay-server/src/metrics_extraction/event.rs b/relay-server/src/metrics_extraction/event.rs index 345bf220dd..63598da12a 100644 --- a/relay-server/src/metrics_extraction/event.rs +++ b/relay-server/src/metrics_extraction/event.rs @@ -1244,7 +1244,7 @@ mod tests { .filter(|b| b.name == "c:spans/usage@none") .collect::>(); - let expected_usage = 7; // We count all spans received by Relay + let expected_usage = 8; // We count all spans received by Relay assert_eq!(usage_metrics.len(), expected_usage); for m in usage_metrics { assert!(m.tags.is_empty()); diff --git a/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap b/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap index 1d13a0658b..e30c2ae81f 100644 --- a/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap +++ b/relay-server/src/metrics_extraction/snapshots/relay_server__metrics_extraction__event__tests__extract_span_metrics_mobile.snap @@ -391,8 +391,11 @@ expression: "(&event.value().unwrap().spans, metrics)" server_address: ~, http_response_status_code: ~, thread_name: ~, + transaction: ~, ui_component_name: ~, url_scheme: ~, + user: ~, + replay_id: ~, other: {}, }, sentry_tags: { @@ -401,7 +404,10 @@ expression: "(&event.value().unwrap().spans, metrics)" "mobile": "true", "op": "process.load", "os.name": "iOS", + "platform": "cocoa", "release": "1.2.3", + "sdk.name": "sentry.javascript.react-native", + "sdk.version": "unknown", "transaction": "gEt /api/:version/users/", "transaction.method": "GET", "ttid": "ttid", @@ -409,6 +415,7 @@ expression: "(&event.value().unwrap().spans, metrics)" received: ~, measurements: ~, _metrics_summary: ~, + platform: ~, other: {}, }, ],