If the type of the metric is rate or count, define the corresponding interval.
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.
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
If the type of the metric is rate or count, define the corresponding interval.
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 metric.
type
string
The type of metric.
source_type_name
string
The source type name.
tags
[string]
A list of tags associated with the metric.
type
enum
The type of metric.
Allowed enum values: 0,1,2,3,15
Create and define a list of queryable tag keys for an existing count/gauge/rate/distribution metric.
Optionally, include percentile aggregations on any distribution metric or configure custom aggregations
on any count, rate, or gauge metric.
Can only be used with application keys of users with the Manage Tags for Metrics permission.
Object for a single metric to be configure tags on.
attributes
object
Object containing the definition of a metric tag configuration to be created.
aggregations
[object]
A list of queryable aggregation combinations for a count, rate, or gauge metric.
By default, count and rate metrics require the (time: sum, space: sum) aggregation and
Gauge metrics require the (time: avg, space: avg) aggregation.
Additional time & space combinations are also available:
time: avg, space: avg
time: avg, space: max
time: avg, space: min
time: avg, space: sum
time: count, space: sum
time: max, space: max
time: min, space: min
time: sum, space: avg
time: sum, space: sum
Can only be applied to metrics that have a metric_type of count, rate, or gauge.
space [required]
enum
A space aggregation for use in query.
Allowed enum values: avg,max,min,sum
time [required]
enum
A time aggregation for use in query.
Allowed enum values: avg,count,max,min,sum
include_percentiles
boolean
Toggle to include/exclude percentiles for a distribution metric.
Defaults to false. Can only be applied to metrics that have a metric_type of distribution.
metric_type [required]
enum
The metric's type.
Allowed enum values: gauge,count,rate,distribution
tags [required]
[string]
A list of tag keys that will be queryable for your metric.
id [required]
string
The metric name for this resource.
type [required]
enum
The metric tag configuration resource type.
Allowed enum values: manage_tags
Response object which includes a single metric’s tag configuration.
Expand All
フィールド
種類
説明
data
object
Object for a single metric tag configuration.
attributes
object
Object containing the definition of a metric tag configuration attributes.
aggregations
[object]
A list of queryable aggregation combinations for a count, rate, or gauge metric.
By default, count and rate metrics require the (time: sum, space: sum) aggregation and
Gauge metrics require the (time: avg, space: avg) aggregation.
Additional time & space combinations are also available:
time: avg, space: avg
time: avg, space: max
time: avg, space: min
time: avg, space: sum
time: count, space: sum
time: max, space: max
time: min, space: min
time: sum, space: avg
time: sum, space: sum
Can only be applied to metrics that have a metric_type of count, rate, or gauge.
space [required]
enum
A space aggregation for use in query.
Allowed enum values: avg,max,min,sum
time [required]
enum
A time aggregation for use in query.
Allowed enum values: avg,count,max,min,sum
created_at
date-time
Timestamp when the tag configuration was created.
include_percentiles
boolean
Toggle to turn on/off percentile aggregations for distribution metrics.
Only present when the metric_type is distribution.
metric_type
enum
The metric's type.
Allowed enum values: gauge,count,rate,distribution
modified_at
date-time
Timestamp when the tag configuration was last modified.
tags
[string]
List of tag keys on which to group.
id
string
The metric name for this resource.
type
enum
The metric tag configuration resource type.
Allowed enum values: manage_tags
// Create a tag configuration returns "Created" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){body:=datadog.MetricTagConfigurationCreateRequest{Data:datadog.MetricTagConfigurationCreateData{Type:datadog.METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS,Id:"ExampleCreateatagconfigurationreturnsCreatedresponse",Attributes:&datadog.MetricTagConfigurationCreateAttributes{Tags:[]string{"app","datacenter",},MetricType:datadog.METRICTAGCONFIGURATIONMETRICTYPES_GAUGE,},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.MetricsApi.CreateTagConfiguration(ctx,"ExampleCreateatagconfigurationreturnsCreatedresponse",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.CreateTagConfiguration`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.CreateTagConfiguration`:\n%s\n",responseContent)}
"""
Create a tag configuration returns "Created" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.metrics_apiimportMetricsApifromdatadog_api_client.v2.model.metric_tag_configuration_create_attributesimport(MetricTagConfigurationCreateAttributes,)fromdatadog_api_client.v2.model.metric_tag_configuration_create_dataimportMetricTagConfigurationCreateDatafromdatadog_api_client.v2.model.metric_tag_configuration_create_requestimportMetricTagConfigurationCreateRequestfromdatadog_api_client.v2.model.metric_tag_configuration_metric_typesimportMetricTagConfigurationMetricTypesfromdatadog_api_client.v2.model.metric_tag_configuration_typeimportMetricTagConfigurationTypebody=MetricTagConfigurationCreateRequest(data=MetricTagConfigurationCreateData(type=MetricTagConfigurationType("manage_tags"),id="ExampleCreateatagconfigurationreturnsCreatedresponse",attributes=MetricTagConfigurationCreateAttributes(tags=["app","datacenter",],metric_type=MetricTagConfigurationMetricTypes("gauge"),),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=MetricsApi(api_client)response=api_instance.create_tag_configuration(metric_name="ExampleCreateatagconfigurationreturnsCreatedresponse",body=body)print(response)
# Create a tag configuration returns "Created" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::MetricsAPI.newbody=DatadogAPIClient::V2::MetricTagConfigurationCreateRequest.new({data:DatadogAPIClient::V2::MetricTagConfigurationCreateData.new({type:DatadogAPIClient::V2::MetricTagConfigurationType::MANAGE_TAGS,id:"ExampleCreateatagconfigurationreturnsCreatedresponse",attributes:DatadogAPIClient::V2::MetricTagConfigurationCreateAttributes.new({tags:["app","datacenter",],metric_type:DatadogAPIClient::V2::MetricTagConfigurationMetricTypes::GAUGE,}),}),})papi_instance.create_tag_configuration("ExampleCreateatagconfigurationreturnsCreatedresponse",body)
/**
* Create a tag configuration returns "Created" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.MetricsApi(configuration);constparams: v2.MetricsApiCreateTagConfigurationRequest={body:{data:{type:"manage_tags",id:"ExampleCreateatagconfigurationreturnsCreatedresponse",attributes:{tags:["app","datacenter"],metricType:"gauge",},},},metricName:"ExampleCreateatagconfigurationreturnsCreatedresponse",};apiInstance.createTagConfiguration(params).then((data: v2.MetricTagConfigurationResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
A list of distribution points series to submit to Datadog.
host
string
The name of the host that produced the distribution point metric.
metric [required]
string
The name of the distribution points metric.
points [required]
[array]
Points relating to the distribution point metric. All points must be tuples with timestamp and a list of values (cannot be a string). Timestamps should be in POSIX time in seconds.
tags
[string]
A list of tags associated with the distribution point metric.
type
enum
The type of the distribution point.
Allowed enum values: distribution
"""
Get active metrics list returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.metrics_apiimportMetricsApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=MetricsApi(api_client)response=api_instance.list_active_metrics(_from=9223372036854775807,)print(response)
# Get active metrics list returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::MetricsAPI.newpapi_instance.list_active_metrics(9223372036854775807)
/**
* Get active metrics list returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.MetricsApi(configuration);constparams: v1.MetricsApiListActiveMetricsRequest={from:9223372036854775807,};apiInstance.listActiveMetrics(params).then((data: v1.MetricsListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get active metrics list returns "OK" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.MetricsApi.ListActiveMetrics(ctx,9223372036854775807,*datadog.NewListActiveMetricsOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.ListActiveMetrics`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.ListActiveMetrics`:\n%s\n",responseContent)}
// Get active metrics list returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.MetricsApi;importcom.datadog.api.v1.client.model.MetricsListResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();MetricsApiapiInstance=newMetricsApi(defaultClient);try{MetricsListResponseresult=apiInstance.listActiveMetrics(9223372036854775807L);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling MetricsApi#listActiveMetrics");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
fromdatadogimportinitialize,apiimporttimeoptions={'api_key':'<DATADOG_API_KEY>','app_key':'<DATADOG_APPLICATION_KEY>'}initialize(**options)# Taking the last 24hoursfrom_time=int(time.time())-60*60*24*1result=api.Metric.list(from_time)print(result)
require'rubygems'require'dogapi'api_key='<DATADOG_API_KEY>'app_key='<DATADOG_APPLICATION_KEY>'dog=Dogapi::Client.new(api_key,app_key)# Get metadata on metricresult=dog.get_metadata('system.net.bytes_sent')
Response object which includes a single metric’s tag configuration.
Expand All
フィールド
種類
説明
data
object
Object for a single metric tag configuration.
attributes
object
Object containing the definition of a metric tag configuration attributes.
aggregations
[object]
A list of queryable aggregation combinations for a count, rate, or gauge metric.
By default, count and rate metrics require the (time: sum, space: sum) aggregation and
Gauge metrics require the (time: avg, space: avg) aggregation.
Additional time & space combinations are also available:
time: avg, space: avg
time: avg, space: max
time: avg, space: min
time: avg, space: sum
time: count, space: sum
time: max, space: max
time: min, space: min
time: sum, space: avg
time: sum, space: sum
Can only be applied to metrics that have a metric_type of count, rate, or gauge.
space [required]
enum
A space aggregation for use in query.
Allowed enum values: avg,max,min,sum
time [required]
enum
A time aggregation for use in query.
Allowed enum values: avg,count,max,min,sum
created_at
date-time
Timestamp when the tag configuration was created.
include_percentiles
boolean
Toggle to turn on/off percentile aggregations for distribution metrics.
Only present when the metric_type is distribution.
metric_type
enum
The metric's type.
Allowed enum values: gauge,count,rate,distribution
modified_at
date-time
Timestamp when the tag configuration was last modified.
tags
[string]
List of tag keys on which to group.
id
string
The metric name for this resource.
type
enum
The metric tag configuration resource type.
Allowed enum values: manage_tags
// List tag configuration by name returns "Success" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "metric_tag_configuration" in the system
MetricTagConfigurationDataID:=os.Getenv("METRIC_TAG_CONFIGURATION_DATA_ID")ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.MetricsApi.ListTagConfigurationByName(ctx,MetricTagConfigurationDataID)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.ListTagConfigurationByName`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.ListTagConfigurationByName`:\n%s\n",responseContent)}
// List tag configuration by name returns "Success" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.MetricsApi;importcom.datadog.api.v2.client.model.MetricTagConfigurationResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();MetricsApiapiInstance=newMetricsApi(defaultClient);// there is a valid "metric_tag_configuration" in the system
StringMETRIC_TAG_CONFIGURATION_DATA_ID=System.getenv("METRIC_TAG_CONFIGURATION_DATA_ID");try{MetricTagConfigurationResponseresult=apiInstance.listTagConfigurationByName(METRIC_TAG_CONFIGURATION_DATA_ID);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling MetricsApi#listTagConfigurationByName");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
List tag configuration by name returns "Success" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.metrics_apiimportMetricsApi# there is a valid "metric_tag_configuration" in the systemMETRIC_TAG_CONFIGURATION_DATA_ID=environ["METRIC_TAG_CONFIGURATION_DATA_ID"]configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=MetricsApi(api_client)response=api_instance.list_tag_configuration_by_name(metric_name=METRIC_TAG_CONFIGURATION_DATA_ID,)print(response)
# List tag configuration by name returns "Success" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::MetricsAPI.new# there is a valid "metric_tag_configuration" in the systemMETRIC_TAG_CONFIGURATION_DATA_ID=ENV["METRIC_TAG_CONFIGURATION_DATA_ID"]papi_instance.list_tag_configuration_by_name(METRIC_TAG_CONFIGURATION_DATA_ID)
/**
* List tag configuration by name returns "Success" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.MetricsApi(configuration);// there is a valid "metric_tag_configuration" in the system
constMETRIC_TAG_CONFIGURATION_DATA_ID=process.env.METRIC_TAG_CONFIGURATION_DATA_IDasstring;constparams: v2.MetricsApiListTagConfigurationByNameRequest={metricName: METRIC_TAG_CONFIGURATION_DATA_ID,};apiInstance.listTagConfigurationByName(params).then((data: v2.MetricTagConfigurationResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
Update the tag configuration of a metric or percentile aggregations of a distribution metric or custom aggregations
of a count, rate, or gauge metric.
Can only be used with application keys from users with the Manage Tags for Metrics permission.
Object for a single tag configuration to be edited.
attributes
object
Object containing the definition of a metric tag configuration to be updated.
aggregations
[object]
A list of queryable aggregation combinations for a count, rate, or gauge metric.
By default, count and rate metrics require the (time: sum, space: sum) aggregation and
Gauge metrics require the (time: avg, space: avg) aggregation.
Additional time & space combinations are also available:
time: avg, space: avg
time: avg, space: max
time: avg, space: min
time: avg, space: sum
time: count, space: sum
time: max, space: max
time: min, space: min
time: sum, space: avg
time: sum, space: sum
Can only be applied to metrics that have a metric_type of count, rate, or gauge.
space [required]
enum
A space aggregation for use in query.
Allowed enum values: avg,max,min,sum
time [required]
enum
A time aggregation for use in query.
Allowed enum values: avg,count,max,min,sum
include_percentiles
boolean
Toggle to include/exclude percentiles for a distribution metric.
Defaults to false. Can only be applied to metrics that have a metric_type of distribution.
tags
[string]
A list of tag keys that will be queryable for your metric.
id [required]
string
The metric name for this resource.
type [required]
enum
The metric tag configuration resource type.
Allowed enum values: manage_tags
Response object which includes a single metric’s tag configuration.
Expand All
フィールド
種類
説明
data
object
Object for a single metric tag configuration.
attributes
object
Object containing the definition of a metric tag configuration attributes.
aggregations
[object]
A list of queryable aggregation combinations for a count, rate, or gauge metric.
By default, count and rate metrics require the (time: sum, space: sum) aggregation and
Gauge metrics require the (time: avg, space: avg) aggregation.
Additional time & space combinations are also available:
time: avg, space: avg
time: avg, space: max
time: avg, space: min
time: avg, space: sum
time: count, space: sum
time: max, space: max
time: min, space: min
time: sum, space: avg
time: sum, space: sum
Can only be applied to metrics that have a metric_type of count, rate, or gauge.
space [required]
enum
A space aggregation for use in query.
Allowed enum values: avg,max,min,sum
time [required]
enum
A time aggregation for use in query.
Allowed enum values: avg,count,max,min,sum
created_at
date-time
Timestamp when the tag configuration was created.
include_percentiles
boolean
Toggle to turn on/off percentile aggregations for distribution metrics.
Only present when the metric_type is distribution.
metric_type
enum
The metric's type.
Allowed enum values: gauge,count,rate,distribution
modified_at
date-time
Timestamp when the tag configuration was last modified.
tags
[string]
List of tag keys on which to group.
id
string
The metric name for this resource.
type
enum
The metric tag configuration resource type.
Allowed enum values: manage_tags
// Update a tag configuration returns "OK" response
packagemainimport("context""encoding/json""fmt""os"datadog"github.com/DataDog/datadog-api-client-go/api/v2/datadog")funcmain(){// there is a valid "metric_tag_configuration" in the system
MetricTagConfigurationDataID:=os.Getenv("METRIC_TAG_CONFIGURATION_DATA_ID")body:=datadog.MetricTagConfigurationUpdateRequest{Data:datadog.MetricTagConfigurationUpdateData{Type:datadog.METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS,Id:MetricTagConfigurationDataID,Attributes:&datadog.MetricTagConfigurationUpdateAttributes{Tags:[]string{"app",},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.MetricsApi.UpdateTagConfiguration(ctx,MetricTagConfigurationDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `MetricsApi.UpdateTagConfiguration`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `MetricsApi.UpdateTagConfiguration`:\n%s\n",responseContent)}
// Update a tag configuration returns "OK" response
importcom.datadog.api.v2.client.ApiClient;importcom.datadog.api.v2.client.ApiException;importcom.datadog.api.v2.client.Configuration;importcom.datadog.api.v2.client.api.MetricsApi;importcom.datadog.api.v2.client.model.MetricTagConfigurationResponse;importcom.datadog.api.v2.client.model.MetricTagConfigurationType;importcom.datadog.api.v2.client.model.MetricTagConfigurationUpdateAttributes;importcom.datadog.api.v2.client.model.MetricTagConfigurationUpdateData;importcom.datadog.api.v2.client.model.MetricTagConfigurationUpdateRequest;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();MetricsApiapiInstance=newMetricsApi(defaultClient);// there is a valid "metric_tag_configuration" in the system
StringMETRIC_TAG_CONFIGURATION_DATA_ID=System.getenv("METRIC_TAG_CONFIGURATION_DATA_ID");MetricTagConfigurationUpdateRequestbody=newMetricTagConfigurationUpdateRequest().data(newMetricTagConfigurationUpdateData().type(MetricTagConfigurationType.MANAGE_TAGS).id(METRIC_TAG_CONFIGURATION_DATA_ID).attributes(newMetricTagConfigurationUpdateAttributes().tags(Collections.singletonList("app"))));try{MetricTagConfigurationResponseresult=apiInstance.updateTagConfiguration(METRIC_TAG_CONFIGURATION_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling MetricsApi#updateTagConfiguration");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a tag configuration returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.metrics_apiimportMetricsApifromdatadog_api_client.v2.model.metric_tag_configuration_typeimportMetricTagConfigurationTypefromdatadog_api_client.v2.model.metric_tag_configuration_update_attributesimport(MetricTagConfigurationUpdateAttributes,)fromdatadog_api_client.v2.model.metric_tag_configuration_update_dataimportMetricTagConfigurationUpdateDatafromdatadog_api_client.v2.model.metric_tag_configuration_update_requestimportMetricTagConfigurationUpdateRequest# there is a valid "metric_tag_configuration" in the systemMETRIC_TAG_CONFIGURATION_DATA_ID=environ["METRIC_TAG_CONFIGURATION_DATA_ID"]body=MetricTagConfigurationUpdateRequest(data=MetricTagConfigurationUpdateData(type=MetricTagConfigurationType("manage_tags"),id=METRIC_TAG_CONFIGURATION_DATA_ID,attributes=MetricTagConfigurationUpdateAttributes(tags=["app",],),),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=MetricsApi(api_client)response=api_instance.update_tag_configuration(metric_name=METRIC_TAG_CONFIGURATION_DATA_ID,body=body)print(response)
# Update a tag configuration returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::MetricsAPI.new# there is a valid "metric_tag_configuration" in the systemMETRIC_TAG_CONFIGURATION_DATA_ID=ENV["METRIC_TAG_CONFIGURATION_DATA_ID"]body=DatadogAPIClient::V2::MetricTagConfigurationUpdateRequest.new({data:DatadogAPIClient::V2::MetricTagConfigurationUpdateData.new({type:DatadogAPIClient::V2::MetricTagConfigurationType::MANAGE_TAGS,id:METRIC_TAG_CONFIGURATION_DATA_ID,attributes:DatadogAPIClient::V2::MetricTagConfigurationUpdateAttributes.new({tags:["app",],}),}),})papi_instance.update_tag_configuration(METRIC_TAG_CONFIGURATION_DATA_ID,body)
/**
* Update a tag configuration returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.MetricsApi(configuration);// there is a valid "metric_tag_configuration" in the system
constMETRIC_TAG_CONFIGURATION_DATA_ID=process.env.METRIC_TAG_CONFIGURATION_DATA_IDasstring;constparams: v2.MetricsApiUpdateTagConfigurationRequest={body:{data:{type:"manage_tags",id: METRIC_TAG_CONFIGURATION_DATA_ID,attributes:{tags:["app"],},},},metricName: METRIC_TAG_CONFIGURATION_DATA_ID,};apiInstance.updateTagConfiguration(params).then((data: v2.MetricTagConfigurationResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));