Skip to content

Commit

Permalink
Merge branch 'master' into ref/global-config-watch
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer authored Sep 6, 2024
2 parents cb422f5 + d9c39f5 commit bf7d470
Show file tree
Hide file tree
Showing 20 changed files with 775 additions and 656 deletions.
804 changes: 323 additions & 481 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bindgen = "0.70.1"
brotli = "6.0.0"
bytecount = "0.6.0"
bytes = "1.4.0"
cadence = "0.29.0"
cadence = "1.4.0"
chrono = { version = "0.4.31", default-features = false, features = [
"std",
"serde",
Expand All @@ -78,12 +78,12 @@ clap = { version = "4.4.6" }
clap_complete = "4.1.1"
cmake = "0.1.46"
console = "0.15.5"
cookie = "0.17.0"
cookie = "0.18.1"
criterion = "0.5"
crossbeam-channel = "0.5.6"
data-encoding = "2.5.0"
debugid = "0.8.0"
dialoguer = "0.10.0"
dialoguer = "0.11.0"
dynfmt = "0.1.4"
ed25519-dalek = "2.0.0"
enumset = "1.0.4"
Expand All @@ -95,25 +95,25 @@ hash32 = "0.3.1"
hashbrown = "0.14.3"
hex = "0.4.3"
hmac = "0.12.1"
hostname = "0.3.1"
hostname = "0.4.0"
human-size = "0.4.1"
hyper-util = { version = "0.1.7", features = ["tokio"] }
indexmap = "2.2.5"
insta = { version = "1.31.0", features = ["json", "redactions", "ron"] }
ipnetwork = "0.20.0"
itertools = "0.13.0"
json-forensics = "0.1.1"
lru = "0.9.0"
maxminddb = "0.23.0"
lru = "0.12.4"
maxminddb = "0.24.0"
memchr = "2.7.4"
md5 = "0.7.0"
mime = "0.3.16"
minidump = "0.22.0"
multer = "2.0.4"
multer = "3.1.0"
num-traits = "0.2.18"
num_cpus = "1.13.0"
once_cell = "1.13.1"
opentelemetry-proto = { git = "https://github.com/open-telemetry/opentelemetry-rust", rev = "dd4c13bd69ca4b24d5a8f21024a466fbb35cdd14" }
opentelemetry-proto = "0.7.0"
parking_lot = "0.12.1"
path-slash = "0.2.1"
pest = "2.1.3"
Expand Down Expand Up @@ -157,7 +157,7 @@ smallvec = { version = "1.11.2", features = ["serde"] }
socket2 = "0.5.7"
sqlparser = "0.44.0"
sqlx = { version = "0.8.1", default-features = false }
statsdproxy = { version = "0.1.2", default-features = false }
statsdproxy = { version = "0.2.0", default-features = false }
symbolic-common = { version = "12.1.2", default-features = false }
symbolic-unreal = { version = "12.1.2", default-features = false }
syn = "1.0.14"
Expand Down
147 changes: 114 additions & 33 deletions relay-dynamic-config/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,39 +960,120 @@ pub fn hardcoded_span_metrics() -> Vec<(GroupKey, Vec<MetricSpec>, Vec<TagMappin
),
(
GroupKey::SpanMetricsTx,
vec![MetricSpec {
category: DataCategory::Span,
mri: "d:transactions/measurements.score.total@ratio".into(),
field: Some("span.measurements.score.total.value".into()),
condition: Some(
// If transactions are extracted from spans, the transaction processing pipeline
// will take care of this metric.
is_allowed_browser.clone() & RuleCondition::eq("span.was_transaction", false),
),
tags: vec![
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
Tag::with_key("transaction.op")
.from_field("span.sentry_tags.transaction.op")
.always(),
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("browser.name")
.from_field("span.browser.name")
.always(), // already guarded by condition on metric
Tag::with_key("user.geo.subregion")
.from_field("span.sentry_tags.user.geo.subregion")
.always(), // already guarded by condition on metric
],
}],
vec![
MetricSpec {
category: DataCategory::Span,
mri: "d:transactions/measurements.score.total@ratio".into(),
field: Some("span.measurements.score.total.value".into()),
condition: Some(
// If transactions are extracted from spans, the transaction processing pipeline
// will take care of this metric.
is_allowed_browser.clone()
& RuleCondition::eq("span.was_transaction", false),
),
tags: vec![
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
Tag::with_key("transaction.op")
.from_field("span.sentry_tags.transaction.op")
.always(),
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("browser.name")
.from_field("span.browser.name")
.always(), // already guarded by condition on metric
Tag::with_key("user.geo.subregion")
.from_field("span.sentry_tags.user.geo.subregion")
.always(), // already guarded by condition on metric
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:transactions/measurements.score.cls@ratio".into(),
field: Some("span.measurements.score.cls.value".into()),
condition: Some(is_allowed_browser.clone()),
tags: vec![
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
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("browser.name")
.from_field("span.sentry_tags.browser.name")
.always(), // already guarded by condition on metric
Tag::with_key("user.geo.subregion")
.from_field("span.sentry_tags.user.geo.subregion")
.always(), // already guarded by condition on metric
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:transactions/measurements.score.weight.cls@ratio".into(),
field: Some("span.measurements.score.weight.cls.value".into()),
condition: Some(is_allowed_browser.clone()),
tags: vec![
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
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("browser.name")
.from_field("span.sentry_tags.browser.name")
.always(), // already guarded by condition on metric
Tag::with_key("user.geo.subregion")
.from_field("span.sentry_tags.user.geo.subregion")
.always(), // already guarded by condition on metric
],
},
MetricSpec {
category: DataCategory::Span,
mri: "d:transactions/measurements.cls@ratio".into(),
field: Some("span.measurements.cls.value".into()),
condition: Some(is_allowed_browser.clone()),
tags: vec![
Tag::with_key("span.op")
.from_field("span.sentry_tags.op")
.always(),
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("browser.name")
.from_field("span.sentry_tags.browser.name")
.always(), // already guarded by condition on metric
Tag::with_key("user.geo.subregion")
.from_field("span.sentry_tags.user.geo.subregion")
.always(), // already guarded by condition on metric
],
},
],
vec![],
),
]
Expand Down
101 changes: 101 additions & 0 deletions relay-event-normalization/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3386,6 +3386,107 @@ mod tests {
"###);
}

#[test]
fn test_computes_standalone_cls_performance_score() {
let json = r#"
{
"type": "transaction",
"timestamp": "2021-04-26T08:00:05+0100",
"start_timestamp": "2021-04-26T08:00:00+0100",
"measurements": {
"cls": {"value": 0.5}
}
}
"#;

let mut event = Annotated::<Event>::from_json(json).unwrap().0.unwrap();

let performance_score: PerformanceScoreConfig = serde_json::from_value(json!({
"profiles": [
{
"name": "Default",
"scoreComponents": [
{
"measurement": "fcp",
"weight": 0.15,
"p10": 900.0,
"p50": 1600.0,
"optional": true,
},
{
"measurement": "lcp",
"weight": 0.30,
"p10": 1200.0,
"p50": 2400.0,
"optional": true,
},
{
"measurement": "cls",
"weight": 0.15,
"p10": 0.1,
"p50": 0.25,
"optional": true,
},
{
"measurement": "ttfb",
"weight": 0.10,
"p10": 200.0,
"p50": 400.0,
"optional": true,
},
],
"condition": {
"op": "and",
"inner": [],
},
}
]
}))
.unwrap();

normalize(
&mut event,
&mut Meta::default(),
&NormalizationConfig {
performance_score: Some(&performance_score),
..Default::default()
},
);

insta::assert_ron_snapshot!(SerializableAnnotated(&event.measurements), {}, @r###"
{
"cls": {
"value": 0.5,
"unit": "none",
},
"score.cls": {
"value": 0.16615877613713903,
"unit": "ratio",
},
"score.total": {
"value": 0.16615877613713903,
"unit": "ratio",
},
"score.weight.cls": {
"value": 1.0,
"unit": "ratio",
},
"score.weight.fcp": {
"value": 0.0,
"unit": "ratio",
},
"score.weight.lcp": {
"value": 0.0,
"unit": "ratio",
},
"score.weight.ttfb": {
"value": 0.0,
"unit": "ratio",
},
}
"###);
}

#[test]
fn test_computed_performance_score_uses_first_matching_profile() {
let json = r#"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ pub fn extract_tags(
}
}
if let Some(measurements) = span.measurements.value() {
if span_op.starts_with("ui.interaction.") && measurements.contains_key("inp") {
if (span_op.starts_with("ui.interaction.") && measurements.contains_key("inp"))
|| span_op.starts_with("ui.webvital.")
{
if let Some(transaction) = span
.data
.value()
Expand Down
7 changes: 1 addition & 6 deletions relay-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ workspace = true
[dependencies]
anyhow = { workspace = true }
serde_path_to_error = { workspace = true }
axum = { workspace = true, features = [
"macros",
"matched-path",
"multipart",
"tracing",
] }
axum = { workspace = true, features = ["macros", "matched-path", "tracing"] }
axum-extra = { workspace = true }
axum-server = { workspace = true }
arc-swap = { workspace = true }
Expand Down
Loading

0 comments on commit bf7d470

Please sign in to comment.