Anomalies API
Cloud cost anomaly detection offers end-to-end monitoring of spikes in your cloud billing seamlessly across all your projects and services. See cost anomalies for more information.
The Anomalies API helps you programmatically obtain cloud cost or usage anomalies for Google Cloud, Amazon Web Services, and Microsoft Azure.
API Reference
The Anomalies API reference is available at https://developer.doit.com/reference/listanomalies
Required Permissions
Cloud Analytics (part of
Standard User
built-in role)
Anomalies API has the following methods:
anomalies.list
The anomalies.list method provides a list of all anomalies available for your cloud platforms.
You can filter the list by using one or more of the following parameters:
Parameter | Description |
---|---|
minCreationTime | string Min value for a time of an anomaly, in milliseconds since the POSIX epoch. If set, only anomalies happened after or at this timestamp are returned. |
maxCreationTime | string Max value for a time of an anomaly time, in milliseconds since the POSIX epoch. If set, only anomalies happened before or at this timestamp are returned. |
filter | string An expression for filtering the results of the request. The syntax is key:[<value>] . For example, the platforms:google-cloud will filter the list to only Google Cloud anomalies.Supported filter keys: - platform - google-cloud , amazon-web-services , or platform:microsoft-azure Learn more about how to use filter *.list requests |
Sample anomalies.list Request using both minCreationTime
and filter
parameters:
curl --location --request GET 'https://api.doit.com/anomalies/v1/?filter=serviceName:BigQuery&minCreationTime=1599436800000' \
--header 'Authorization: Bearer your-api-key'
your-api-key
Replace "your-api-key" with your actual API key as explained at Getting Started
Sample anomalies.list Response:
{
"rowCount": 2,
"anomalies": [
{
"anomalyId": "7c045b29-57ee-437b-9dc0-e7e4eb005a64",
"billingAccount": "01A29B-B56F30-AA7597",
"platform": "google-cloud",
"scope": "iottempstreaming",
"serviceName": "BigQuery",
"severityLevel": "warning",
"timeFrame": "hourly",
"startTime": 1612818000000
},
{
"anomalyId": "36ba6c14-bd3c-40e3-bfa2-31189ea740b4",
"billingAccount": "01A29B-B56F30-AA7597",
"platform": "google-cloud",
"scope": "iottempstreaming",
"serviceName": "BigQuery",
"severityLevel": "critical",
"timeFrame": "daily",
"startTime": 1612656000000
}
]
}
anomalies.get
Get the full details of the individual anomaly using the anomaly id.
Sample anomalies.get Request
curl --location --request GET 'https://api.doit.com/anomalies/v1/7c045b29-57ee-437b-9dc0-e7e4eb005a64' \
--header 'Authorization: Bearer your-api-key'
your-api-key
Always replace "your-api-key" with your actual API key as explained at Getting Started
Sample anomalies.get Response:
{
"anomalyChartUrl": "https://storage.googleapis.com/me-doit-intl-com-gcp-anomalies/7c045b29-57ee-437b-9dc0-e7e4eb005a64.png",
"billingAccount": "01C29B-B56F30-AA7597",
"cloudProvider": "google-cloud",
"scope": "iottempstreaming",
"serviceName": "BigQuery",
"severityLevel": "warning",
"timeFrame": "hourly",
"startTime": 1612818000000
}
Response Body
If successful, the response body contains an instance of Anomaly
{
"billingAccount":string,
"platform":string,
"scope":string,
"serviceName":string,
"severityLevel":string,
"startTime":integer,
"timeFrame":string
}
Response Body Fields
Field | Description |
---|---|
billingAccount | string Unique anomaly identifier |
platform | string The cloud platform for the anomaly. Can be google-cloud , amazon-web-services , or microsoft-azure |
scope | string The Google Cloud project ID, AWS account ID, or Azure resource group name for the given anomaly |
serviceName | string The name of the service causing the anomaly. Examples are EC2, BigQuery, SQS, etc. |
severityLevel | string All anomalies are classified as "info", "warning" or "critical" |
timeFrame | string Anomalies can be DAILY (when a certain day is abnormally large compared to other days) or HOURLY (a certain hour is abnormally large compared to other hours of the same day). |
startTime | number The time when this anomaly was detected, in milliseconds since the epoch.` |
Updated 5 months ago