timeseries_query
Creates, updates, deletes, gets or lists a timeseries_query resource.
Overview
| Name | timeseries_query |
| Type | Resource |
| Id | datadog.metrics.timeseries_query |
Fields
The following fields are returned by SELECT queries:
- query_metrics
| Name | Datatype | Description |
|---|---|---|
display_name | string | Display name of the metric. (example: system.cpu.idle) |
aggr | string | Aggregation type. (example: avg) |
end | integer (int64) | End of the time window, milliseconds since Unix epoch. |
expression | string | Metric expression. (example: system.cpu.idle{host:foo,env:test}) |
interval | integer (int64) | Number of milliseconds between data samples. |
length | integer (int64) | Number of data samples. |
metric | string | Metric name. (example: system.cpu.idle) |
pointlist | array | List of points of the timeseries in milliseconds. |
query_index | integer (int64) | The index of the series' query within the request. |
scope | string | Metric scope, comma separated list of tags. (example: host:foo,env:test) |
start | integer (int64) | Start of the time window, milliseconds since Unix epoch. |
tag_set | array | Unique tags identifying this series. |
unit | array | Detailed information about the metric unit. The first element describes the "primary unit" (for example, bytes in bytes per second). The second element describes the "per unit" (for example, second in bytes per second). If the second element is not present, the API returns null. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
query_metrics | select | from, to, query | Query timeseries points. Datadog recommends using the v2<br />/api/v2/query/timeseries endpoint over this endpoint for<br />querying timeseries data. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
from | integer (int64) | Start of the queried time period, seconds since the Unix epoch. |
query | string | Query string. |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
to | integer (int64) | End of the queried time period, seconds since the Unix epoch. |
SELECT examples
- query_metrics
Query timeseries points. Datadog recommends using the v2<br />/api/v2/query/timeseries endpoint over this endpoint for<br />querying timeseries data.
SELECT
display_name,
aggr,
end,
expression,
interval,
length,
metric,
pointlist,
query_index,
scope,
start,
tag_set,
unit
FROM datadog.metrics.timeseries_query
WHERE from = '{{ from }}' -- required
AND to = '{{ to }}' -- required
AND query = '{{ query }}' -- required
;