The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards.
The maximum payload size is 3.2 megabytes (3200000 bytes). Compressed payloads must have a decompressed size of less than 62 megabytes (62914560 bytes).
If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect:
64 bits for the timestamp
64 bits for the value
40 bytes for the metric names
50 bytes for the timeseries
The full payload is approximately 100 bytes. However, with the DogStatsD API,
compression is applied, which reduces the payload size.
If the type of the metric is rate or count, define the corresponding interval in seconds.
metric [required]
string
The name of the timeseries.
points [required]
[array]
Points relating to a metric. All points must be tuples with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past.
tags
[string]
A list of tags associated with the metric.
type
string
The type of the metric. Valid types are "",count, gauge, and rate.
## default
#
See one of the other client libraries for an example of sending deflate-compressed data.
## Dynamic Points
# Post time-series data that can be graphed on Datadog’s dashboards.
See one of the other client libraries for an example of sending deflate-compressed data.
fromdatadogimportinitialize,apiimporttimeoptions={'api_key':'<DATADOG_API_KEY>'## EU costumers need to define 'api_host' as below#'api_host': 'https://api.datadoghq.eu/'}initialize(**options)now=time.time()future_10s=now+10# Submit a single point with a timestamp of `now`api.Metric.send(metric='page.views',points=1000)# Submit a point with a timestamp (must be current)api.Metric.send(metric='my.pair',points=(now,15))# Submit multiple points.api.Metric.send(metric='my.series',points=[(now,15),(future_10s,16)])# Submit a point with a host and tags.api.Metric.send(metric='my.series',points=100,host="myhost.example.com",tags=["version:1"])# Submit multiple metricsapi.Metric.send([{'metric':'my.series','points':15},{'metric':'my1.series','points':16}])
require'rubygems'require'dogapi'api_key='<DATADOG_API_KEY>'dog=Dogapi::Client.new(api_key)# Submit one metric value.dog.emit_point('some.metric.name',50.0,:host=>"my_host.example.com")# Submit multiple metric valuespoints=[[Time.now,0],[Time.now+10,10.0],[Time.now+20,20.0]]dog.emit_points('some.metric.name',points,:tags=>["version:1"])# Emit differents metrics in a single request to be more efficientdog.batch_metricsdodog.emit_point('test.api.test_metric',10)dog.emit_point('test.api.this_other_metric',1)end
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"cargo run
/**
* Submit deflate metrics returns "Payload accepted" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.MetricsApi(configuration);constparams: v1.MetricsApiSubmitMetricsRequest={body:{series:[{metric:"system.load.1",type:"gauge",points:[[Math.round(newDate().getTime()/1000),1.1]],tags:["test:ExampleMetric"],},],},contentEncoding:"deflate",};apiInstance.submitMetrics(params).then((data: v1.IntakePayloadAccepted)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Submit metrics returns "Payload accepted" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.MetricsApi(configuration);constparams: v1.MetricsApiSubmitMetricsRequest={body:{series:[{metric:"system.load.1",type:"gauge",points:[[Math.round(newDate().getTime()/1000),1.1]],tags:["test:ExampleMetric"],},],},};apiInstance.submitMetrics(params).then((data: v1.IntakePayloadAccepted)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
The metrics end-point allows you to post time-series data that can be graphed on Datadog’s dashboards.
The maximum payload size is 500 kilobytes (512000 bytes). Compressed payloads must have a decompressed size of less than 5 megabytes (5242880 bytes).
If you’re submitting metrics directly to the Datadog API without using DogStatsD, expect:
64 bits for the timestamp
64 bits for the value
20 bytes for the metric names
50 bytes for the timeseries
The full payload is approximately 100 bytes.
Host name is one of the resources in the Resources field.
If the type of the metric is rate or count, define the corresponding interval in seconds.
metadata
object
Metadata for the metric.
origin
object
Metric origin information.
metric_type
int32
The origin metric type code
product
int32
The origin product code
service
int32
The origin service code
metric [required]
string
The name of the timeseries.
points [required]
[object]
Points relating to a metric. All points must be objects with timestamp and a scalar value (cannot be a string). Timestamps should be in POSIX time in seconds, and cannot be more than ten minutes in the future or more than one hour in the past.
timestamp
int64
The timestamp should be in seconds and current.
Current is defined as not more than 10 minutes in the future or more than 1 hour in the past.
value
double
The numeric value format should be a 64bit float gauge-type value.
resources
[object]
A list of resources to associate with this metric.
name
string
The name of the resource.
type
string
The type of the resource.
source_type_name
string
The source type name.
tags
[string]
A list of tags associated with the metric.
type
enum
The type of metric. The available types are 0 (unspecified), 1 (count), 2 (rate), and 3 (gauge).
Allowed enum values: 0,1,2,3
## default
#
See one of the other client libraries for an example of sending deflate-compressed data.
## Dynamic Points
# Post time-series data that can be graphed on Datadog’s dashboards.
See one of the other client libraries for an example of sending deflate-compressed data.
// Submit metrics returns "Payload accepted" responsepackagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.MetricPayload{Series:[]datadogV2.MetricSeries{{Metric:"system.load.1",Type:datadogV2.METRICINTAKETYPE_UNSPECIFIED.Ptr(),Points:[]datadogV2.MetricPoint{{Timestamp:datadog.PtrInt64(time.Now().Unix()),Value:datadog.PtrFloat64(0.7),},},Resources:[]datadogV2.MetricResource{{Name:datadog.PtrString("dummyhost"),Type:datadog.PtrString("host"),},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewMetricsApi(apiClient)resp,r,err:=api.SubmitMetrics(ctx,body,*datadogV2.NewSubmitMetricsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.SubmitMetrics`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.SubmitMetrics`:\n%s\n",responseContent)}
// Submit metrics with compression returns "Payload accepted" responsepackagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.MetricPayload{Series:[]datadogV2.MetricSeries{{Metric:"system.load.1",Type:datadogV2.METRICINTAKETYPE_UNSPECIFIED.Ptr(),Points:[]datadogV2.MetricPoint{{Timestamp:datadog.PtrInt64(time.Now().Unix()),Value:datadog.PtrFloat64(0.7),},},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewMetricsApi(apiClient)resp,r,err:=api.SubmitMetrics(ctx,body,*datadogV2.NewSubmitMetricsOptionalParameters().WithContentEncoding(datadogV2.METRICCONTENTENCODING_ZSTD1))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.SubmitMetrics`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.SubmitMetrics`:\n%s\n",responseContent)}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"cargo run
/**
* Submit metrics returns "Payload accepted" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.MetricsApi(configuration);constparams: v2.MetricsApiSubmitMetricsRequest={body:{series:[{metric:"system.load.1",type:0,points:[{timestamp: Math.round(newDate().getTime()/1000),value: 0.7,},],resources:[{name:"dummyhost",type:"host",},],},],},};apiInstance.submitMetrics(params).then((data: v2.IntakePayloadAccepted)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
/**
* Submit metrics with compression returns "Payload accepted" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.MetricsApi(configuration);constparams: v2.MetricsApiSubmitMetricsRequest={body:{series:[{metric:"system.load.1",type:0,points:[{timestamp: Math.round(newDate().getTime()/1000),value: 0.7,},],},],},contentEncoding:"zstd1",};apiInstance.submitMetrics(params).then((data: v2.IntakePayloadAccepted)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));