-
Notifications
You must be signed in to change notification settings - Fork 142
RUM-10378 Collect battery attributes #2351
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
RUM-10378 Collect battery attributes #2351
Conversation
da7046c
to
b783e3d
Compare
Datadog ReportBranch report: ✅ 0 Failed, 3123 Passed, 859 Skipped, 5m 32.88s Total duration (41.37s time saved) New Flaky Tests (1)
|
58c28c1
to
725c8c6
Compare
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 - left some minor questions/suggestions
/// Describe the battery state for mobile devices. | ||
public struct BrightnessStatus: Codable, Equatable { | ||
/// The brightness level | ||
public let level: Float |
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.
If we don't expect more properties - could it be flattened to use float directly?
We could typealias BrightnessLevel = Float
for readability.
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're right ! I've made the changes.
@@ -525,6 +525,10 @@ extension DatadogContextProvider { | |||
subscribe(\.isLowPowerModeEnabled, to: LowPowerModePublisher(notificationCenter: notificationCenter, processInfo: processInfo)) | |||
#endif | |||
|
|||
#if os(iOS) |
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.
Is there anything for tvOS on that front?
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.
Yes, this should be available on tvOS as well!
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.
Hey! Actually I checked on the documentation and it's not available for tvOS.
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.
Looks great!! As @maciejburda mention, I think the brightness could be available on tvOS
@@ -525,6 +525,10 @@ extension DatadogContextProvider { | |||
subscribe(\.isLowPowerModeEnabled, to: LowPowerModePublisher(notificationCenter: notificationCenter, processInfo: processInfo)) | |||
#endif | |||
|
|||
#if os(iOS) |
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.
Yes, this should be available on tvOS as well!
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.
Disregard my previous comment, brightness
is not available on tvOS
725c8c6
to
b49fbbc
Compare
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
[email protected] cancelled this merge request build |
/remove |
View all feedbacks in Devflow UI.
|
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
Tests failed on this commit 1d6c514: What to do next?
|
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
Tests failed on this commit 7155548: What to do next?
|
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
|
What and why?
This PR adds support for collecting battery-related attributes in the RUM event model:
battery_level
: The current battery charge level, expressed as a float from 0.0 (empty) to 1.0 (full).low_power_mode
: A boolean indicating whether the device is currently in Low Power Mode.brightness_level
: The current screen brightness, normalized as a float between 0.0 (darkest) and 1.0 (brightest).These attributes provide crucial context for analyzing app performance and behavior under different power conditions. They help teams understand usage patterns on low-battery devices, identify potential regressions caused by power-saving configurations, and optimize experiences for energy-constrained environments
Review checklist
make api-surface
)