Skip to content

Conversation

@marco-saia-datadog
Copy link
Member

@marco-saia-datadog marco-saia-datadog commented Nov 24, 2025

What does this PR do?

Adds new attributes to the Device Info:

  • totalRam: The total RAM in megabytes
  • processorCount: Number of device processors
  • isLowRamDevice: Whether the device is considered a low RAM device (from ActivityManager.isLowRamDevice)

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-12199/new-device-capability-metrics branch 2 times, most recently from a5339c4 to 899ef0f Compare November 24, 2025 15:07
@marco-saia-datadog marco-saia-datadog changed the title [FEAT] Added 'totalRam', 'processorCount' and 'isLowRamDevice' to DeviceInfo RUM-12199: Added 'totalRam', 'processorCount' and 'isLowRamDevice' to DeviceInfo Nov 24, 2025
@marco-saia-datadog marco-saia-datadog changed the title RUM-12199: Added 'totalRam', 'processorCount' and 'isLowRamDevice' to DeviceInfo RUM-12199: Add 'totalRam', 'processorCount' and 'isLowRamDevice' to DeviceInfo Nov 24, 2025
@marco-saia-datadog marco-saia-datadog changed the title RUM-12199: Add 'totalRam', 'processorCount' and 'isLowRamDevice' to DeviceInfo RUM-12199: Add totalRam, processorCount and isLowRamDevice to DeviceInfo Nov 24, 2025
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-12199/new-device-capability-metrics branch 2 times, most recently from 65945bf to 55a5484 Compare November 24, 2025 15:35
@datadog-official
Copy link

datadog-official bot commented Nov 24, 2025

🎯 Code Coverage
Patch Coverage: 84.49%
Total Coverage: 71.49% (+0.06%)

View detailed report

This comment will be updated automatically if new data arrives.
* Fix with Cursor requires Datadog plugin ≥v2.17.0
🔗 Commit SHA: a4e01bd | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 78.65169% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.26%. Comparing base (e253017) to head (a4e01bd).

Files with missing lines Patch % Lines
...core/internal/system/DefaultAndroidInfoProvider.kt 18.75% 13 Missing ⚠️
...tadog/android/core/internal/NoOpContextProvider.kt 0.00% 3 Missing ⚠️
...id/core/internal/system/NoOpAndroidInfoProvider.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3024      +/-   ##
===========================================
+ Coverage    71.25%   71.26%   +0.01%     
===========================================
  Files          866      866              
  Lines        31734    31807      +73     
  Branches      5360     5360              
===========================================
+ Hits         22610    22665      +55     
- Misses        7596     7614      +18     
  Partials      1528     1528              
Files with missing lines Coverage Δ
...tlin/com/datadog/android/api/context/DeviceInfo.kt 100.00% <100.00%> (ø)
...og/android/core/internal/DatadogContextProvider.kt 97.92% <100.00%> (+0.14%) ⬆️
...android/log/internal/domain/DatadogLogGenerator.kt 98.02% <100.00%> (+0.03%) ⬆️
...g/android/rum/internal/DatadogLateCrashReporter.kt 86.60% <100.00%> (+0.73%) ⬆️
...ndroid/rum/internal/domain/scope/RumActionScope.kt 97.07% <100.00%> (+0.04%) ⬆️
...roid/rum/internal/domain/scope/RumResourceScope.kt 91.12% <100.00%> (+0.45%) ⬆️
.../android/rum/internal/domain/scope/RumViewScope.kt 94.12% <100.00%> (+0.09%) ⬆️
...ndroid/telemetry/internal/TelemetryEventHandler.kt 85.93% <100.00%> (+1.77%) ⬆️
...trace/internal/domain/event/BaseSpanEventMapper.kt 70.45% <100.00%> (-2.72%) ⬇️
...tadog/android/core/internal/NoOpContextProvider.kt 2.27% <0.00%> (-0.17%) ⬇️
... and 2 more

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-12199/new-device-capability-metrics branch from c356214 to a4e01bd Compare December 11, 2025 11:57
@marco-saia-datadog marco-saia-datadog marked this pull request as ready for review December 11, 2025 13:19
@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner December 11, 2025 13:19
Comment on lines +359 to +363
"processor_count": {
"type" : "number",
"description": "Number of device processors",
"readOnly": true
},
Copy link
Member

Choose a reason for hiding this comment

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

Probably the naming is not the best one, because processor is a chip containing multiple cores. We probably want to send the number of physical cores, right?

Comment on lines +131 to +133
override val processorCount: Int by lazy(LazyThreadSafetyMode.PUBLICATION) {
Runtime.getRuntime().availableProcessors()
}
Copy link
Member

Choose a reason for hiding this comment

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

not sure if we want to send the number of processors (chips) or cores, but this method returns the number of physical cores and not the number of chips.

}
}

override val processorCount: Int by lazy(LazyThreadSafetyMode.PUBLICATION) {
Copy link
Member

Choose a reason for hiding this comment

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

unless we have any performance concerns, we can use default mode

Suggested change
override val processorCount: Int by lazy(LazyThreadSafetyMode.PUBLICATION) {
override val processorCount: Int by lazy {

}

@Suppress("UnsafeThirdPartyFunctionCall") // Called within a try/catch block
override val totalRam: Int? by lazy(LazyThreadSafetyMode.PUBLICATION) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
override val totalRam: Int? by lazy(LazyThreadSafetyMode.PUBLICATION) {
override val totalRam: Int? by lazy {

}

@Suppress("UnsafeThirdPartyFunctionCall") // Called within a try/catch block
override val isLowRamDevice: Boolean? by lazy(LazyThreadSafetyMode.PUBLICATION) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
override val isLowRamDevice: Boolean? by lazy(LazyThreadSafetyMode.PUBLICATION) {
override val isLowRamDevice: Boolean? by lazy {

Runtime.getRuntime().availableProcessors()
}

@Suppress("UnsafeThirdPartyFunctionCall") // Called within a try/catch block
Copy link
Member

Choose a reason for hiding this comment

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

minor: it is better to move this annotation right to the call site rather than to keep it for the whole method. I guess here it will be getMemoryInfo and ActivityManager.MemoryInfo() constructor can be declared as safe in YAML config.

Comment on lines +30 to +32
val processorCount: Int = forge.anInt()
val totalRam: Int = forge.anInt()
val isLowRamDevice: Boolean = forge.aBool()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
val processorCount: Int = forge.anInt()
val totalRam: Int = forge.anInt()
val isLowRamDevice: Boolean = forge.aBool()
val processorCount = forge.anInt()
val totalRam = forge.aNullable { anInt() }
val isLowRamDevice = forge.aNullable { aBool() }

Comment on lines +29 to +30
totalRam = forge.anInt(),
isLowRamDevice = forge.aBool()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
totalRam = forge.anInt(),
isLowRamDevice = forge.aBool()
totalRam = forge.aNullable { anInt() },
isLowRamDevice = forge.aNullable { aBool() }

Comment on lines +399 to +401
processorCount = datadogContext.deviceInfo.processorCount,
totalRam = datadogContext.deviceInfo.totalRam,
isLowRamDevice = datadogContext.deviceInfo.isLowRamDevice
Copy link
Member

Choose a reason for hiding this comment

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

we need to add assertions for these new properties in tests for RumViewScope, RumResourceScope, etc.

@marco-saia-datadog marco-saia-datadog changed the title RUM-12199: Add totalRam, processorCount and isLowRamDevice to DeviceInfo RUM-13468: Add totalRam, processorCount and isLowRamDevice to DeviceInfo Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants