-
Notifications
You must be signed in to change notification settings - Fork 133
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
RUMM-1278 RefreshRate is normalized to 0...60 #608
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -39,7 +39,7 @@ class VitalInfoSamplerTests: XCTestCase { | |||
XCTAssertEqual(sampler.memory.meanValue, 321.0) | |||
XCTAssertGreaterThan(sampler.memory.sampleCount, 1) | |||
let maxFPS = Double(UIScreen.main.maximumFramesPerSecond) | |||
XCTAssertEqual(sampler.refreshRate.meanValue, 666.0 / maxFPS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have left the 666 value and then used:
XCTAssertEqual(sampler.refreshRate.meanValue, (666.0 / maxFPS) * 60.0)
9784a51
to
b1437d5
Compare
@@ -39,7 +39,7 @@ internal final class VitalInfoSampler { | |||
|
|||
var refreshRate: VitalInfo { | |||
let info = refreshRatePublisher.currentValue | |||
return info.scaledDown(by: maximumRefreshRate) | |||
return info.scaledDown(by: maximumRefreshRate / 60.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about defining a constant and adding a comment on normalization? I'm afraid that this might become forgotten and unclear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added to the line above
NOTE:
refreshRate
is normalized to 0...60 range, assuming 60 is the industry standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with using a constant value for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can't come up with a local variable name which doesn't make things more confusing 🤔
any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct Constants {
// We use normalized 0...60 range for refresh rate in Mobile Vitals,
// assuming 60 is the industry standard.
static let normalizedRefreshRate = 60
}
Is +/- what we do in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
…rate-scale RUMM-1278 RefreshRate is normalized to 0...60 (cherry picked from commit 818ed4c)
What and why?
RefreshRate
is shown as a mobile vital in Datadog UI.It needs to be normalized as different devices can have different maximum FPS rates.
How?
It was normalized to 0...1, this was not consistent with other platforms.
Now it is normalized to 0...60 range, as browser and Android SDKs do.
Review checklist