Metrics API - GET metric data points
Gets data points of the specified metrics.
You can receive either one aggregated data point per series or a list of data points per series. See the description of the resolution parameter of the request for more information.
The following limits apply:
- The number of aggregated data points in the response is limited to 1,000
- The number of series in the response is limited to 1,000
- The number of data points per series is limited to 10,080
- The overall number of data points is limited to 100,000
The request produces an application/json
payload.
This request is an early adopter release and may be changed in non compatible way.
GET |
|
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
selector | string |
Selects metrics for the query by their keys. You can select up to 10 metrics for one query. You can specify multiple metric keys separated by commas. For example: To select multiple metrics belonging to the same parent, you can use a this shorthand: list the last part of the required metric keys in parentheses, separated by commas, while keeping the common part untouched. For example, to list the You can set additional transformation operators, separated by a colon ( The length of the selector string is limited to 1,000 characters. |
path | required |
nextPageKey | string |
Continuation token obtained from |
query | optional |
pageSize | integer |
Preferred amount of primary entities for which data is delivered in a single response payload. |
query | optional |
resolution | string |
You can use one of the following options:
Valid units for the timespan are:
If not set, the default is 120 data points. |
query | optional |
from | string |
The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of two weeks from now is used ( |
query | optional |
to | string |
The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. |
query | optional |
scope | string |
Specifies the scope of the query. You can set one or several of the following criteria:
To set several criteria, separate them with a comma ( The scope is limited to 10,000 entities. If your scope exceeds 10,000 entities, split it into several queries. You can't use dimensions in the scope. You can, however, use the To set a universal scope, matching all entities, omit this parameter. The length of the selector string is limited to 1,000 characters. |
query | optional |
Response format
The MetricSeriesMap object
A list of metrics and their data points.
Element | Type | Description |
---|---|---|
totalCount | integer | Pagination: Total number of involved primary entities being paged over. If none of the requested metrics is suitable for paging, this is set to zero. |
nextPageKey | string | Pagination: Continuation token for use with query parameter of same name to obtain next page of results. |
metrics | object | A list of metrics and their data points. The content depends on the resolution you set in the query:
|
warnings | string[] | Additional notes about the result, useful for debugging. |
The MetricResult object
A list of metric and their data points.
The content depends on the resolution you set in the query:
- If you used the
Inf
value for a single data point it contains the values array. - If you used other options (amount of data points of a time step), it contains the series array.
Element | Type | Description |
---|---|---|
series | MetricSeries[] | The list of metric series and the data points of each series. A series is a metric per dimension (a unique combination of metric and dimension). |
values | MetricValue[] | The list of aggregated data points for the metric. Each data point is an object, containing the timestamp of the data point, the data point value, and the dimension to which the data point belongs. |
entityMeta | MetricEntityMeta |
The MetricEntityMeta object
Element | Type | Description |
---|---|---|
name | object |
The MetricValue object
An aggregated data point of a metric series.
Element | Type | Description |
---|---|---|
dimensions | string[] | The ordered list of dimension to which the data point belongs. Each metric can have a certain number of dimensions. Dimensions exceeding this number are aggregated into one, which is shown as |
timestamp | integer | The end timestamp of the data point, in UTC milliseconds. |
value | number | The value of the aggregated data point. |
The MetricSeries object
The list of metric series along with their data points.
A series is a metric per dimension (a unique combination of metric and dimension).
Element | Type | Description |
---|---|---|
dimensions | string[] | The ordered list of dimensions to which the data point belongs. Each metric can have a certain number of dimensions. Dimensions exceeding this number are aggregated into one, which is shown as |
values | MetricTimestampedValue[] | The ordered list of data points. |
The MetricTimestampedValue object
A data point of a metric series.
Element | Type | Description |
---|---|---|
timestamp | integer | The end timestamp of the data point, in UTC milliseconds. |
value | number | The value of the data point. |
{
"totalCount": 10,
"nextPageKey": "___a7acX3q0AAAAAACJidWlsdGluOnNlcnZpY2UuZXJyb3JzLmZvdXJ4eC5yYXRlAAAAAAAAAFAAAAFs2B9gewAAAWWAbjR7AAABbNgfYHsBAAABAEJ2dTlOUlZSUzNxMEEwNUFDVUFBQkFCaE1iRlZrV1cxMU5WTXlUVEJCUzBaNVIxVjJOSGt6Y3oyLTcwMUZWRkxlclH__9rtpxferQ",
"metrics": {
"builtin:host.cpu.user": {
"series": [
{
"dimensions": [
"HOST-0123456789ABCDEF"
],
"values": [
{
"timestamp": 1549000000000,
"value": 0.5
},
{
"timestamp": 1549000000000,
"value": 10.1
},
{
"timestamp": 1549000000000,
"value": 20.5
},
{
"timestamp": 1549000000000,
"value": 40.5
},
{
"timestamp": 1549000000000,
"value": 60.5
},
{
"timestamp": 1549000000000,
"value": 80.5
},
{
"timestamp": 1549000000000,
"value": 100.1
}
]
},
{
"dimensions": [
"HOST-ABCDEF0123456789"
],
"values": [
{
"timestamp": 1549000000000,
"value": 0.5
},
{
"timestamp": 1549000000000,
"value": 10.1
},
{
"timestamp": 1549000000000,
"value": 20.5
},
{
"timestamp": 1549000000000,
"value": 40.5
},
{
"timestamp": 1549000000000,
"value": 60.5
},
{
"timestamp": 1549000000000,
"value": 80.5
},
{
"timestamp": 1549000000000,
"value": 100.1
}
]
}
]
}
}
}
Timeframe note
DESK stores data in time slots. The MetricValue object shows the ending timestamp of the slot. If the time, set in the from or to parameters of your query, falls within the data time slot, this time slot is included in the response.
If the timestamp of the last data slot lays outside of the specified timeframe, the last data point of the response has a later timestamp than the specified in to query parameter.
DESK does not predict future data. The timestamp of the last data point may lay in the future, due to data slots principle, described above. In this case, this data slot has incomplete data.
Examples
In these examples, the requests query the data points of the builtin:host.cpu.usage and builtin:host.cpu.idle metrics. The scope is limited to the management zone with the ID of 9130632296508575249. The timeframe is not specified, so the default timeframe of 2 weeks back from now is used.
The API token is passed in the Authorization header.
The difference between the queries is the representation of data—the first shows the list of data points, while the second shows just one aggregated data point for each series.
The result is truncated to two series per metric and three data points per series for the list of data points.
Curl
curl -X GET \
'https://mySampleEnv.live.dexp.ae/api/v2/metrics/series/builtin:host.cpu.%28usage,idle%29?scope=mzid%289130632296508575249%29&resolution=100' \
-H 'Authorization: Api-Token abcdefjhij1234567890'
Request URL
https://mySampleEnv.live.dexp.ae/api/v2/metrics/series/builtin:host.cpu.%28usage,idle%29?scope=mzid%289130632296508575249%29&resolution=100
Response body
{
"metrics": {
"builtin:host.cpu.usage": {
"series": [
{
"dimensions": [
"HOST-661B5DDFE19DB5AE"
],
"values": [
{
"timestamp": 1559563200000,
"value": 0.7537290219907408
},
{
"timestamp": 1559574000000,
"value": 0.6646773726851852
},
{
"timestamp": 1559584800000,
"value": 0.6338252314814815
}
]
},
{
"dimensions": [
"HOST-7CF622A2AB0AFFD3"
],
"values": [
{
"timestamp": 1559563200000,
"value": 2.614283130787037
},
{
"timestamp": 1559574000000,
"value": 2.5198640046296297
},
{
"timestamp": 1559584800000,
"value": 2.3291558159722223
}
]
}
]
},
"builtin:host.cpu.idle": {
"series": [
{
"dimensions": [
"HOST-661B5DDFE19DB5AE"
],
"values": [
{
"timestamp": 1559563200000,
"value": 99.24627097800926
},
{
"timestamp": 1559574000000,
"value": 99.33532262731481
},
{
"timestamp": 1559584800000,
"value": 99.36617476851852
}
]
},
{
"dimensions": [
"HOST-7CF622A2AB0AFFD3"
],
"values": [
{
"timestamp": 1559563200000,
"value": 97.38571686921296
},
{
"timestamp": 1559574000000,
"value": 97.48013599537038
},
{
"timestamp": 1559584800000,
"value": 97.67084418402777
}
]
}
]
}
}
}
Response code
200
Curl
curl -X GET \
'https://mySampleEnv.live.dexp.ae/api/v2/metrics/series/builtin:host.cpu.%28usage,idle%29?scope=mzid%289130632296508575249%29&resolution=Inf' \
-H 'Authorization: Api-Token abcdefjhij1234567890'
Request URL
https://mySampleEnv.live.dexp.ae/api/v2/metrics/series/builtin:host.cpu.%28usage,idle%29?scope=mzid%289130632296508575249%29&resolution=Inf
Response body
{
"metrics": {
"builtin:host.cpu.usage": {
"values": [
{
"dimensions": [
"HOST-7CF622A2AB0AFFD3"
],
"timestamp": 1560768060000,
"value": 2.386910363843232
},
{
"dimensions": [
"HOST-661B5DDFE19DB5AE"
],
"timestamp": 1560768060000,
"value": 0.593878413974555
}
]
},
"builtin:host.cpu.idle": {
"values": [
{
"dimensions": [
"HOST-7CF622A2AB0AFFD3"
],
"timestamp": 1560768060000,
"value": 97.61308963615677
},
{
"dimensions": [
"HOST-661B5DDFE19DB5AE"
],
"timestamp": 1560768060000,
"value": 99.40612158602545
}
]
}
}
}
Response code
200