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(webvitals): Updates performance score values to use 0-1 cdf values instead of the actual raw component score #2734

Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- `normalize_performance_score` stores 0 to 1 cdf score instead of weighted score for each performance score component. ([#2734](https://github.com/getsentry/relay/pull/2734))

**Bug Fixes**:

- Fix bug introduced in 23.11.0 that broke profile-transaction association. ([#2733](https://github.com/getsentry/relay/pull/2733))
Expand Down
4 changes: 4 additions & 0 deletions py/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- `normalize_performance_score` stores 0 to 1 cdf score instead of weighted score for each performance score component. ([#2734](https://github.com/getsentry/relay/pull/2734))

## 0.8.37

- License is now FSL instead of BSL ([#2739](https://github.com/getsentry/relay/pull/2739))
Expand Down
21 changes: 11 additions & 10 deletions relay-event-normalization/src/normalize/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,18 +884,19 @@ fn normalize_performance_score(
break;
}
let mut score_total = 0.0;
let mut weight_total = 0.0;
for component in &profile.score_components {
if let Some(value) = measurements.get_value(component.measurement.as_str()) {
let subscore =
utils::calculate_cdf_score(value, component.p10, component.p50)
* component.weight;
score_total += subscore;
let cdf = utils::calculate_cdf_score(value, component.p10, component.p50);
let component_score = cdf * component.weight;
score_total += component_score;
weight_total += component.weight;
should_add_total = true;

measurements.insert(
format!("score.{}", component.measurement),
Measurement {
value: subscore.into(),
value: cdf.into(),
unit: (MetricUnit::Fraction(FractionUnit::Ratio)).into(),
}
.into(),
Expand All @@ -915,7 +916,7 @@ fn normalize_performance_score(
measurements.insert(
"score.total".to_owned(),
Measurement {
value: score_total.into(),
value: (score_total / weight_total).into(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actionable for this PR, but to not forget about if/how we can remove the score.total measurement.

unit: (MetricUnit::Fraction(FractionUnit::Ratio)).into(),
}
.into(),
Expand Down Expand Up @@ -2169,19 +2170,19 @@ mod tests {
"unit": "millisecond",
},
"score.cls": {
"value": 0.21864170607444863,
"value": 0.8745668242977945,
"unit": "ratio",
},
"score.fcp": {
"value": 0.10750855443790831,
"value": 0.7167236962527221,
"unit": "ratio",
},
"score.fid": {
"value": 0.19657361348282545,
"value": 0.6552453782760849,
"unit": "ratio",
},
"score.lcp": {
"value": 0.009238896571386584,
"value": 0.03079632190462195,
"unit": "ratio",
},
"score.total": {
Expand Down