异常
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Google Play Developer Reporting API,您可以检索在指标集中检测到的异常情况。每次指标值超出预期范围时,系统都会生成异常,而预期范围是根据同一指标前 28 天的值确定的。连续多天的异常会合并为单个异常结果。
如果某项指标的值出现异常增加的情况并持续足够长的时间,检测模型会进行调整并扩大预期值范围,直到后续数据点不再被视为异常。
检索异常值
您可以使用 anomalies.list 方法列出异常。
简单请求:
此 HTTP GET
请求指定了应用名称参数,并返回应用的完整检测到的异常列表。
GET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies
异常响应:
响应包含足够的信息,可用于准确查询异常发生的位置:
{
"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"
}
}
},
]
}
过滤后的请求:
您可以应用过滤条件,仅返回在特定时间段内处于有效状态的异常。为此,请在请求的过滤条件字段中指定 activeBetween(start, end)
函数。您可以使用特殊关键字 UNBOUNDED
在范围的任一侧指定无界限的限制。如果指定开始或结束界限,则必须遵循 RFC 3339 格式,例如 2022-02-22T04:00Z
。
GET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies?filter=activeBetween("2022-01-01T00:00:00Z", UNBOUNDED)
过滤后的响应:
响应仅包含在指定时间范围内处于有效状态的异常:
{
"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"
}
}
},
]
}
可用指标
目前,并非所有指标和指标集都支持异常检测。以下是目前支持的指标列表:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe Google Play Developer Reporting API allows you to retrieve anomalies, which are detected when a metric value falls outside its expected range based on the previous 28 days of data.\u003c/p\u003e\n"],["\u003cp\u003eConsecutive days of anomalies are merged into a single result, and the detection model adapts over time if an increase in a metric's value persists.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve anomalies using the \u003ccode\u003eanomalies.list\u003c/code\u003e method, filtering by an active time period with the \u003ccode\u003eactiveBetween\u003c/code\u003e function.\u003c/p\u003e\n"],["\u003cp\u003eAnomaly responses include information for identifying the anomaly, such as the affected metric, its value, and the time period it occurred.\u003c/p\u003e\n"],["\u003cp\u003eAnomaly detection is currently supported for specific metrics within the ANR rate, crash rate, excessive wakeup rate, and stuck background wakelock rate metric sets.\u003c/p\u003e\n"]]],["The Google Play Developer Reporting API detects anomalies when metric values exceed their expected range, based on the previous 28 days. Anomalies are retrievable via the `anomalies.list` method using a `GET` request. The response provides anomaly details, including the metric set, timeline, and metric value. Filtering is supported to find anomalies active within a specific time range with the `activeBetween(start, end)` function. Supported metrics for anomaly detection include `anrRate`, `crashRate`, `excessiveWakeupRate`, and `stuckBgWakelockRate`.\n"],null,["# Anomalies\n\nThe Google Play Developer Reporting API lets you retrieve anomalies detected in metric sets. An anomaly is\nproduced every time the metric value exceeds the expected range of the metric, based on the\nprevious 28 days of values for that same metric. Anomalies for consecutive days are merged into\na single anomaly result.\n\n\nIf the anomalous increase in the value of a metric persists for\nlong enough, the detection model adapts and widens the expected values until subsequent\ndatapoints aren't considered anomalous anymore.\n\nRetrieving anomalies\n--------------------\n\n\nAnomalies can be listed with the\n[anomalies.list](/play/developer/reporting/reference/rest/v1beta1/anomalies/list) method.\n\n#### Simple request:\n\n\nThis HTTP `GET` request specifies the application name parameter and returns the\nfull list of detected anomalies for your application. \n\n```text\nGET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies\n```\n\n#### Anomaly response:\n\n\nThe response includes enough information to query exactly where the anomaly occurred: \n\n```verilog\n{\n \"anomalies\": [\n {\n \"name\": \"apps/com.example.app/anomalies/12345\"\n \"metric_set\": \"apps/com.example.app/anrRateMetricSet\"\n \"timeline_spec\": {\n \"aggregation_period\": \"DAILY\"\n \"start_time\": {\n \"year\": 2022\n \"month\": 1\n \"day\": 23\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n \"end_time\": {\n \"year\": 2022\n \"month\": 1\n \"day\": 23\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n }\n \"metric\": {\n \"metric\": \"anrRate\",\n \"decimal_value\": {\n \"value\": \"3.1415926535\"\n }\n }\n },\n {\n \"name\": \"apps/com.example.app/anomalies/12345\"\n \"metric_set\": \"apps/com.example.app/crashRateMetricSet\"\n \"timeline_spec\": {\n \"aggregation_period\": \"DAILY\"\n \"start_time\": {\n \"year\": 2021\n \"month\": 12\n \"day\": 10\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n \"end_time\": {\n \"year\": 2021\n \"month\": 12\n \"day\": 10\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n }\n \"metric\": {\n \"metric\": \"crashRate\",\n \"decimal_value\": {\n \"value\": \"2.7182818284\"\n }\n }\n },\n ]\n}\n```\n\n#### Filtered request:\n\n\nIt is possible to apply a filter to return only anomalies that were active on a specific period\nof time. To do this, specify the `activeBetween(start, end)` function\nin the filter field in the request. It is possible to specify unbounded limits at either side\nof the range with the special keyword `UNBOUNDED`. If specifying a start or end\nbound, it must follow the RFC 3339 format, e.g. `2022-02-22T04:00Z`. \n\n```text\nGET https://playdeveloperreporting.googleapis.com/v1beta1/apps/com.example.app/anomalies?filter=activeBetween(\"2022-01-01T00:00:00Z\", UNBOUNDED)\n```\n\n#### Filtered response:\n\n\nThe response only includes anomalies that were active in the specified time range: \n\n```verilog\n{\n \"anomalies\": [\n {\n \"name\": \"apps/com.example.app/anomalies/12345\"\n \"metric_set\": \"apps/com.example.app/anrRateMetricSet\"\n \"timeline_spec\": {\n \"aggregation_period\": \"DAILY\"\n \"start_time\": {\n \"year\": 2022\n \"month\": 1\n \"day\": 23\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n \"end_time\": {\n \"year\": 2022\n \"month\": 1\n \"day\": 23\n \"time_zone\": {\n \"id\": \"America/Los_Angeles\"\n }\n }\n }\n \"metric\": {\n \"metric\": \"anrRate\",\n \"decimal_value\": {\n \"value\": \"3.1415926535\"\n }\n }\n },\n ]\n}\n```\n\nAvailable metrics\n-----------------\n\n\nNot all metrics and metric sets currently support anomaly detection. Here's the list of\ncurrently supported metrics:\n\n| Metric set | Supported metrics |\n|---------------------------------------------------------------------------------------------------------------------------|---------------------|\n| [vitals.anrrate](/play/developer/reporting/reference/rest/v1beta1/vitals.anrrate) | anrRate |\n| [vitals.crashrate](/play/developer/reporting/reference/rest/v1beta1/vitals.crashrate) | crashRate |\n| [vitals.excessivewakeuprate](/play/developer/reporting/reference/rest/v1beta1/vitals.excessivewakeuprate) | excessiveWakeupRate |\n| [vitals.stuckbackgroundwakelockrate](/play/developer/reporting/reference/rest/v1beta1/vitals.stuckbackgroundwakelockrate) | stuckBgWakelockRate |"]]