Skip to content

Commit

Permalink
ref(spans): Split tag mapping in specific configs (#2773)
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops authored Nov 27, 2023
1 parent 9fc05ab commit ec0b7a5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
47 changes: 31 additions & 16 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
("span.", "system"),
("", "transaction.method"),
("", "transaction.op"),
("", "resource.render_blocking_status"), // only set for resource spans
("", "file_extension"), // only set for resource spans
("", "ttid"), // only set for mobile spans
("", "ttfd"), // only set for mobile spans
("span.", "main_thread"), // only set for mobile spans
]
.map(|(prefix, key)| TagSpec {
key: format!("{prefix}{key}"),
Expand All @@ -181,14 +176,20 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
// Mobile-specific tags:
TagMapping {
metrics: vec![LazyGlob::new("d:spans/exclusive_time*@millisecond".into())],
tags: ["release", "device.class"] // TODO: sentry PR for static strings
.map(|key| TagSpec {
key: key.into(),
field: Some(format!("span.sentry_tags.{}", key)),
value: None,
condition: Some(RuleCondition::eq("span.sentry_tags.mobile", "true")),
})
.into(),
tags: [
("", "device.class"),
("", "release"),
("", "ttfd"),
("", "ttid"),
("span.", "main_thread"),
]
.map(|(prefix, key)| TagSpec {
key: format!("{prefix}{key}"),
field: Some(format!("span.sentry_tags.{}", key)),
value: None,
condition: Some(RuleCondition::eq("span.sentry_tags.mobile", "true")),
})
.into(),
},
// Resource-specific tags:
TagMapping {
Expand All @@ -199,19 +200,33 @@ pub fn add_span_metrics(project_config: &mut ProjectConfig) {
],
tags: [
("", "environment"),
("", "file_extension"),
("", "resource.render_blocking_status"),
("", "transaction"),
("span.", "description"),
("span.", "domain"),
("span.", "group"),
("span.", "op"),
("", "transaction"),
("", "resource.render_blocking_status"),
]
.map(|(prefix, key)| TagSpec {
key: format!("{prefix}{key}"),
field: Some(format!("span.sentry_tags.{}", key)),
value: None,
condition: Some(resource_condition.clone()),
})
.into(),
},
TagMapping {
metrics: vec![LazyGlob::new("d:spans/exclusive_time*@millisecond".into())],
tags: [
("", "file_extension"),
("", "resource.render_blocking_status"),
]
.map(|(prefix, key)| TagSpec {
key: format!("{prefix}{key}"),
field: Some(format!("span.sentry_tags.{}", key)),
value: None,
condition: None,
condition: Some(resource_condition.clone()),
})
.into(),
},
Expand Down
3 changes: 2 additions & 1 deletion relay-server/src/metrics_extraction/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,13 +1188,14 @@ mod tests {
#[test]
fn test_display_times_extracted() {
let span = r#"{
"op": "http.client",
"op": "ui.load",
"span_id": "bd429c44b67a3eb4",
"start_timestamp": 1597976300.0000000,
"timestamp": 1597976302.0000000,
"exclusive_time": 100,
"trace_id": "ff62a8b040f340bda5d830223def1d81",
"sentry_tags": {
"mobile": "true",
"ttid": "ttid",
"ttfd": "ttfd"
}
Expand Down

0 comments on commit ec0b7a5

Please sign in to comment.