Skip to main content

Android Metrics

Memfault's Bort 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, Bort supports High resolution telemetry, where Bort records multiple values for a metric over the heartbeat interval, allowing changes to the metric to be visualized in more 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 Bort 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: Custom Metrics

The Bort 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.