getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.16k stars 435 forks source link

`HealthStats` measurements #2367

Open marandaneto opened 1 year ago

marandaneto commented 1 year ago

Description

Investigate if HealthStats fits the concept of our own measurements set in the transaction. https://developer.android.com/reference/android/os/health/HealthStats If those measurements can be measured within a transaction, maybe we can send them by default as well.

markushi commented 1 year ago

Let's investigate if this is useful for us

stefanosiano commented 1 year ago

HealthStats provide several classes of data (only for Android N: api 24+): UidHealthStats, PidHealthStats, PackageHealthStats , ProcessHealthStats, and ServiceHealthStats A snapshot of the current measurements can be retrieved with [SystemHealth.takeMyUidSnapshot()](https://developer.android.com/reference/android/os/health/SystemHealthManager#takeMyUidSnapshot()) We could get the snapshot when a transaction starts and another when the transaction finishes, then compare the results.

There are really a lot of possible values we could get (visit links above for them), like how long the flashlight was used, how many foreground activities are spawn and how long they took, how long the process was in background, how much data was sent or received via bluetooth or wifi, time spent by the process with screen off, how many anrs or crashes there were, time spent in user space or in kernel, etc. Not all of them are always available, but there are definitely interesting things

kahest commented 1 year ago

Investigation is done, need to take results to planning and create issues for implementation.

romtsn commented 1 year ago

This has already been planned for Q1 (or maybe Q2), so we just assigned the labels and priority and eventually gonna implement it.