The Google Play Developer Reporting API lets you retrieve anomalies detected in metric sets. An anomaly is produced every time the metric value exceeds the expected range of the metric, based on the previous 28 days of values for that same metric. Anomalies for consecutive days are merged into a single anomaly result.
If the anomalous increase in the value of a metric persists for long enough, the detection model adapts and widens the expected values until subsequent datapoints aren't considered anomalous anymore.
Retrieving anomalies
Anomalies can be listed with the anomalies.list method.
Simple request:
This HTTP GET
request specifies the application name parameter and returns the
full list of detected anomalies for your application.
GET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies
Anomaly response:
The response includes enough information to query exactly where the anomaly occurred:
{ "anomalies": [ { "name": "apps/com.example.app/anomalies/12345" "metric_set": "apps/com.example.app/anrRateMetricSet" "timeline_spec": { "aggregation_period": "DAILY" "start_time": { "year": 2022 "month": 1 "day": 23 "time_zone": { "id": "America/Los_Angeles" } } "end_time": { "year": 2022 "month": 1 "day": 23 "time_zone": { "id": "America/Los_Angeles" } } } "metric": { "metric": "anrRate", "decimal_value": { "value": "3.1415926535" } } }, { "name": "apps/com.example.app/anomalies/12345" "metric_set": "apps/com.example.app/crashRateMetricSet" "timeline_spec": { "aggregation_period": "DAILY" "start_time": { "year": 2021 "month": 12 "day": 10 "time_zone": { "id": "America/Los_Angeles" } } "end_time": { "year": 2021 "month": 12 "day": 10 "time_zone": { "id": "America/Los_Angeles" } } } "metric": { "metric": "crashRate", "decimal_value": { "value": "2.7182818284" } } }, ] }
Filtered request:
It is possible to apply a filter to return only anomalies that were active on a specific period
of time. To do this, specify the activeBetween(start, end)
function
in the filter field in the request. It is possible to specify unbounded limits at either side
of the range with the special keyword UNBOUNDED
. If specifying a start or end
bound, it must follow the RFC 3339 format, e.g. 2022-02-22T04:00Z
.
GET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies?filter=activeBetween("2022-01-01T00:00:00Z", UNBOUNDED)
Filtered response:
The response only includes anomalies that were active in the specified time range:
{ "anomalies": [ { "name": "apps/com.example.app/anomalies/12345" "metric_set": "apps/com.example.app/anrRateMetricSet" "timeline_spec": { "aggregation_period": "DAILY" "start_time": { "year": 2022 "month": 1 "day": 23 "time_zone": { "id": "America/Los_Angeles" } } "end_time": { "year": 2022 "month": 1 "day": 23 "time_zone": { "id": "America/Los_Angeles" } } } "metric": { "metric": "anrRate", "decimal_value": { "value": "3.1415926535" } } }, ] }
Available metrics
Not all metrics and metric sets currently support anomaly detection. Here's the list of currently supported metrics:
Metric set | Supported metrics |
---|---|
vitals.anrrate |
anrRate |
vitals.crashrate |
crashRate |
vitals.excessivewakeuprate |
excessiveWakeupRate |
vitals.stuckbackgroundwakelockrate |
stuckBgWakelockRate |