Skip to main content

Android Metrics

Memfault's Android SDK makes it easy to collect all kinds of metrics to diagnose issues on a per-device basis, and to monitor trends on a fleet-wide basis.

See Metrics for details on how metrics can be configured and used in the Memfault dashboard.

Heartbeats

Each device will check-in to Memfault at the end of its reporting period (typically 1 hour). At this time, the device can choose to record a single value for each metric, representing the value over that hour. This is sometimes referred to as a "heartbeat" metric, derived during the "heartbeat" interval, and uploaded in the "heartbeat" report.

HRT example

Heartbeat metrics only record 1 value every hour.

Attributes

Dashboard Configuration

Marking a Heartbeat metric as an Attribute implies that we primarily care about the latest value of the metric, for that device. This allows for searching for all current devices matching that Attribute. We can also create a Device Set for that metric, which gives a coarse-grained daily count of devices matching the attribute condition.

Device Attributes

Once a device has recorded an Attribute, its latest recorded value can be can be viewed on the individual device's page.

Timeseries

Dashboard Configuration

On the other hand, marking a Heartbeat metric as Timeseries implies that we primarily care about its historical value over a longer timespan, which allows for more complex time-based search queries, and Metric Charts for comparing the metric across different software versions.

Timeseries metrics make it easy to monitor the health of your fleet over time, to decide whether metrics are over or underperforming, and to identify the devices that are reporting that metric.

Metric Charts

Timeseries Metrics can be aggregated and visualized over several weeks (shown here from Calendar Weeks 41 to 48).

High resolution telemetry (HRT)

In addition to the single Heartbeat metric recorded in the Heartbeat report, the Android SDK supports High resolution telemetry, where multiple values are recorded for a metric over the Heartbeat interval, allowing changes to the metric to be visualized in greater detail in the Device Timeline view.

HRT example

Multiple values per hour can be recorded and visualized using HRT.

These metrics are also uploaded at the same time as the Heartbeat report, but they are not available for use as Timeseries or Attribute metrics. They are used exclusively for device-level diagnostics and debugging.

Built-in metrics

Main article: Built-in Metrics

The Android SDK automatically collects many different metrics by querying the Android OS, in both the Heartbeat report and in HRT where it makes sense. These include:

  • batterystats
  • disk space
  • device temperature
  • network connectivity
  • network usage

Custom metrics

Main article: Metrics

The Android SDK also allows for collecting your own domain-specific metrics in addition to the built-in metrics, via the use of the Reporting library from any Java, Kotlin, or Native code on the device.

All values recorded by Reporting library are recorded and uploaded in High resolution, and then specific aggregations can be specified by the library to derive a single value as a Heartbeat metric. This makes it easier to automatically calculate a single value, such as the average temperature of the device over the Heartbeat interval, instead of keeping track of that state yourself.