Update the tag configuration of a metric or percentile aggregations of a distribution metric or custom aggregations
of a count, rate, or gauge metric. By setting exclude_tags_mode to true the behavior is changed
from an allow-list to a deny-list, and tags in the defined list will not be queryable.
Can only be used with application keys from users with the Manage Tags for Metrics permission. This endpoint requires
a tag configuration to be created first.
This endpoint requires the metric_tags_write 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]
Deprecated. You no longer need to configure specific time and space aggregations for Metrics Without Limits.
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
exclude_tags_mode
boolean
When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
Defaults to false. Requires tags property.
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.
default:
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
Field
Type
Description
data
object
Object for a single metric tag configuration.
attributes
object
Object containing the definition of a metric tag configuration attributes.
aggregations
[object]
Deprecated. You no longer need to configure specific time and space aggregations for Metrics Without Limits.
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.
exclude_tags_mode
boolean
When set to true, the configuration will exclude the configured tags and include any other submitted tags.
When set to false, the configuration will include the configured tags and exclude any other submitted tags.
Defaults to false. Requires tags property.
include_percentiles
boolean
Toggle to include or exclude 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
default: gauge
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" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "metric_tag_configuration" in the systemMetricTagConfigurationDataID:=os.Getenv("METRIC_TAG_CONFIGURATION_DATA_ID")body:=datadogV2.MetricTagConfigurationUpdateRequest{Data:datadogV2.MetricTagConfigurationUpdateData{Type:datadogV2.METRICTAGCONFIGURATIONTYPE_MANAGE_TAGS,Id:MetricTagConfigurationDataID,Attributes:&datadogV2.MetricTagConfigurationUpdateAttributes{Tags:[]string{"app",},},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewMetricsApi(apiClient)resp,r,err:=api.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" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.MetricsApi;importcom.datadog.api.client.v2.model.MetricTagConfigurationResponse;importcom.datadog.api.client.v2.model.MetricTagConfigurationType;importcom.datadog.api.client.v2.model.MetricTagConfigurationUpdateAttributes;importcom.datadog.api.client.v2.model.MetricTagConfigurationUpdateData;importcom.datadog.api.client.v2.model.MetricTagConfigurationUpdateRequest;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();MetricsApiapiInstance=newMetricsApi(defaultClient);// there is a valid "metric_tag_configuration" in the systemStringMETRIC_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
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_metrics::MetricsAPI;usedatadog_api_client::datadogV2::model::MetricTagConfigurationType;usedatadog_api_client::datadogV2::model::MetricTagConfigurationUpdateAttributes;usedatadog_api_client::datadogV2::model::MetricTagConfigurationUpdateData;usedatadog_api_client::datadogV2::model::MetricTagConfigurationUpdateRequest;#[tokio::main]asyncfnmain(){// there is a valid "metric_tag_configuration" in the system
letmetric_tag_configuration_data_id=std::env::var("METRIC_TAG_CONFIGURATION_DATA_ID").unwrap();letbody=MetricTagConfigurationUpdateRequest::new(MetricTagConfigurationUpdateData::new(metric_tag_configuration_data_id.clone(),MetricTagConfigurationType::MANAGE_TAGS,).attributes(MetricTagConfigurationUpdateAttributes::new().tags(vec!["app".to_string()])),);letconfiguration=datadog::Configuration::new();letapi=MetricsAPI::with_config(configuration);letresp=api.update_tag_configuration(metric_tag_configuration_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<API-KEY>"DD_APP_KEY="<APP-KEY>"cargo run
/**
* 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));