Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(performance):Store perf score cdf measurement on span #4438

Merged
merged 7 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
102 changes: 102 additions & 0 deletions relay-event-normalization/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,16 @@ pub fn normalize_performance_score(
component.p10,
component.p50,
);

measurements.insert(
format!("score.ratio.{}", component.measurement),
Measurement {
value: cdf.into(),
unit: (MetricUnit::Fraction(FractionUnit::Ratio)).into(),
}
.into(),
);

let component_score = cdf * normalized_component_weight;
score_total += component_score;
should_add_total = true;
Expand Down Expand Up @@ -2393,6 +2403,22 @@ mod tests {
"value": 0.009238896571386584,
"unit": "ratio",
},
"score.ratio.cls": {
"value": 0.8745668242977945,
"unit": "ratio",
},
"score.ratio.fcp": {
"value": 0.7167236962527221,
"unit": "ratio",
},
"score.ratio.fid": {
"value": 0.6552453782760849,
"unit": "ratio",
},
"score.ratio.lcp": {
"value": 0.03079632190462195,
"unit": "ratio",
},
"score.total": {
"value": 0.531962770566569,
"unit": "ratio",
Expand Down Expand Up @@ -2541,6 +2567,22 @@ mod tests {
"value": 0.009238896571386584,
"unit": "ratio",
},
"score.ratio.cls": {
"value": 0.8745668242977945,
"unit": "ratio",
},
"score.ratio.fcp": {
"value": 0.7167236962527221,
"unit": "ratio",
},
"score.ratio.fid": {
"value": 0.6552453782760849,
"unit": "ratio",
},
"score.ratio.lcp": {
"value": 0.03079632190462195,
"unit": "ratio",
},
"score.total": {
"value": 0.531962770566569,
"unit": "ratio",
Expand Down Expand Up @@ -2689,6 +2731,22 @@ mod tests {
"value": 0.009238896571386584,
"unit": "ratio",
},
"score.ratio.cls": {
"value": 0.8745668242977945,
"unit": "ratio",
},
"score.ratio.fcp": {
"value": 0.7167236962527221,
"unit": "ratio",
},
"score.ratio.fid": {
"value": 0.6552453782760849,
"unit": "ratio",
},
"score.ratio.lcp": {
"value": 0.03079632190462195,
"unit": "ratio",
},
"score.total": {
"value": 0.531962770566569,
"unit": "ratio",
Expand Down Expand Up @@ -2882,6 +2940,14 @@ mod tests {
"value": 0.66666415149198,
"unit": "ratio",
},
"score.ratio.a": {
"value": 0.9999964593987591,
"unit": "ratio",
},
"score.ratio.b": {
"value": 0.9999962272379699,
"unit": "ratio",
},
"score.total": {
"value": 0.9999963046248997,
"unit": "ratio",
Expand Down Expand Up @@ -2999,6 +3065,10 @@ mod tests {
"timestamp": 1619420405.0,
"start_timestamp": 1619420400.0,
"measurements": {
"score.ratio.ttfb": {
"value": 1.0,
"unit": "ratio",
},
"score.total": {
"value": 1.0,
"unit": "ratio",
Expand Down Expand Up @@ -3147,6 +3217,10 @@ mod tests {
"value": 0.0,
"unit": "ratio",
},
"score.ratio.inp": {
"value": 0.0,
"unit": "ratio",
},
"score.total": {
"value": 0.0,
"unit": "ratio",
Expand Down Expand Up @@ -3376,6 +3450,10 @@ mod tests {
"value": 0.0,
"unit": "ratio",
},
"score.ratio.inp": {
"value": 0.0,
"unit": "ratio",
},
"score.total": {
"value": 0.0,
"unit": "ratio",
Expand Down Expand Up @@ -3465,6 +3543,10 @@ mod tests {
"value": 0.16615877613713903,
"unit": "ratio",
},
"score.ratio.cls": {
"value": 0.16615877613713903,
"unit": "ratio",
},
"score.total": {
"value": 0.16615877613713903,
"unit": "ratio",
Expand Down Expand Up @@ -3566,6 +3648,10 @@ mod tests {
"value": 0.8999999314038525,
"unit": "ratio",
},
"score.ratio.lcp": {
"value": 0.8999999314038525,
"unit": "ratio",
},
"score.total": {
"value": 0.8999999314038525,
"unit": "ratio",
Expand Down Expand Up @@ -3739,6 +3825,14 @@ mod tests {
"value": 0.66666415149198,
"unit": "ratio",
},
"score.ratio.a": {
"value": 0.9999964593987591,
"unit": "ratio",
},
"score.ratio.b": {
"value": 0.9999962272379699,
"unit": "ratio",
},
"score.total": {
"value": 0.9999963046248997,
"unit": "ratio",
Expand Down Expand Up @@ -3900,6 +3994,14 @@ mod tests {
"value": 0.3024363365482667,
"unit": "ratio",
},
"score.ratio.a": {
"value": 0.45365450482239994,
"unit": "ratio",
},
"score.ratio.b": {
"value": 0.45365450482239994,
"unit": "ratio",
},
"score.total": {
"value": 0.4536545048224,
"unit": "ratio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ expression: "SerializableAnnotated(&Annotated::new(event))"
"value": 0.00000001611009708968325,
"unit": "ratio",
},
"score.ratio.app_start_cold": {
"value": 0.00000004833029126904975,
"unit": "ratio",
},
"score.ratio.time_to_full_display": {
"value": 0.0000011387439833310253,
"unit": "ratio",
},
"score.ratio.time_to_initial_display": {
"value": 0.0000001978930093127218,
"unit": "ratio",
},
"score.time_to_full_display": {
"value": 0.00000037958132777700843,
"unit": "ratio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ expression: "SerializableAnnotated(&Annotated::new(event))"
"value": 0.000016961769767009915,
"unit": "ratio",
},
"score.ratio.app_start_warm": {
"value": 0.000050885309301029746,
"unit": "ratio",
},
"score.ratio.time_to_full_display": {
"value": 0.024374448803942572,
"unit": "ratio",
},
"score.ratio.time_to_initial_display": {
"value": 0.006641015685528939,
"unit": "ratio",
},
"score.time_to_full_display": {
"value": 0.008124816267980856,
"unit": "ratio",
Expand Down
34 changes: 34 additions & 0 deletions relay-server/src/metrics_extraction/transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,40 @@ mod tests {
extracted_from_indexed: false,
},
},
Bucket {
timestamp: UnixTimestamp(1619420400),
width: 0,
name: MetricName(
"d:transactions/measurements.score.ratio.lcp@ratio",
),
value: Distribution(
[
0.0,
],
),
tags: {
"browser.name": "Chrome",
"dist": "foo",
"environment": "fake_environment",
"fOO": "bar",
"geo.country_code": "US",
"http.method": "POST",
"os.name": "Windows",
"platform": "javascript",
"release": "1.2.3",
"transaction": "gEt /api/:version/users/",
"transaction.op": "mYOp",
"transaction.status": "ok",
"user.geo.subregion": "21",
},
metadata: BucketMetadata {
merges: 1,
received_at: Some(
UnixTimestamp(0),
),
extracted_from_indexed: false,
},
},
Bucket {
timestamp: UnixTimestamp(1619420400),
width: 0,
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/test_spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,11 @@ def test_span_ingestion_with_performance_scores(
"score.fcp": {"value": 0.14999972769539766},
"score.fid": {"value": 0.14999999985},
"score.lcp": {"value": 0.29986141375718806},
"score.ratio.cls": {"value": 0.0},
"score.ratio.fcp": {"value": 0.9999981846359844},
"score.ratio.fid": {"value": 0.4999999995},
"score.ratio.lcp": {"value": 0.9995380458572936},
"score.ratio.ttfb": {"value": 0.0},
"score.total": {"value": 0.5998611413025857},
"score.ttfb": {"value": 0.0},
"score.weight.cls": {"value": 0.25},
Expand Down Expand Up @@ -1284,6 +1289,7 @@ def test_span_ingestion_with_performance_scores(
"measurements": {
"inp": {"value": 100.0},
"score.inp": {"value": 0.9948129113413748},
"score.ratio.inp": {"value": 0.9948129113413748},
"score.total": {"value": 0.9948129113413748},
"score.weight.inp": {"value": 1.0},
},
Expand Down
Loading