Response Object that includes your query and the list of metrics retrieved.
Expand All
Field
Type
Description
error
string
Message indicating the errors if status is not ok.
from_date
int64
Start of requested time window, milliseconds since Unix epoch.
group_by
[string]
List of tag keys on which to group.
message
string
Message indicating success if status is ok.
query
string
Query string
res_type
string
Type of response.
series
[object]
List of timeseries queried.
aggr
string
Aggregation type.
display_name
string
Display name of the metric.
end
int64
End of the time window, milliseconds since Unix epoch.
expression
string
Metric expression.
interval
int64
Number of milliseconds between data samples.
length
int64
Number of data samples.
metric
string
Metric name.
pointlist
[array]
List of points of the timeseries in milliseconds.
query_index
int64
The index of the series' query within the request.
scope
string
Metric scope, comma separated list of tags.
start
int64
Start of the time window, milliseconds since Unix epoch.
tag_set
[string]
Unique tags identifying this series.
unit
[object]
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.
family
string
Unit family, allows for conversion between units of the same family, for scaling.
name
string
Unit name
plural
string
Plural form of the unit name.
scale_factor
double
Factor for scaling between units of the same family.
short_name
string
Abbreviation of the unit.
status
string
Status of the query.
to_date
int64
End of requested time window, milliseconds since Unix epoch.
require'rubygems'require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Get points from the last hourfrom=Time.now-3600to=Time.nowquery='system.cpu.idle{*}by{host}'dog.get_points(query,from,to)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Query timeseries points returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.MetricsApi(configuration);constparams: v1.MetricsApiQueryMetricsRequest={from:Math.round(newDate(newDate().getTime()+-1*86400*1000).getTime()/1000),to: Math.round(newDate().getTime()/1000),query:"system.cpu.idle{*}",};apiInstance.queryMetrics(params).then((data: v1.MetricsQueryResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));