Skip to main content

tags

Creates, updates, deletes, gets or lists a tags resource.

Overview

Nametags
TypeResource
Iddatadog.metrics.tags

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe metric name for this resource. (example: test.metric.latency)
attributesobjectObject containing the definition of a metric's indexed and ingested tags.
typestringThe metric resource type. (metrics) (default: metrics, example: metrics)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_tags_by_metric_nameselectmetric_namewindow[seconds], filter[tags], filter[match], filter[include_tag_values], filter[allow_partial], page[limit]View indexed and ingested tags for a given metric name.<br />Results are filtered by the window&#91;seconds&#93; parameter, which defaults to 14400 (4 hours).

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.

NameDatatypeDescription
metric_namestringThe name of the metric. (example: dist.http.endpoint.request)
sitestringThe 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.
filter[allow_partial]booleanWhether to allow partial results. Defaults to false. (example: false)
filter[include_tag_values]booleanWhether to include tag values in the response. Defaults to true. (example: true)
filter[match]stringFilter returned tags to those matching a substring. For example, filter&#91;match&#93;=env returns tags like env:prod, environment:staging, etc. (example: env)
filter[tags]stringFilter results to tags from data points that have the specified tags. For example, filter&#91;tags&#93;=env:staging,host:123 returns tags only from data points with both env:staging and host:123. (example: env:staging,host:123)
page[limit]integer (int32)Maximum number of results to return. (example: 1000)
window[seconds]integer (int64)The number of seconds of look back (from now) to query for tag data. Default value is 14400 (4 hours), minimum value is 14400 (4 hours). (example: 14400)

SELECT examples

View indexed and ingested tags for a given metric name.<br />Results are filtered by the window&#91;seconds&#93; parameter, which defaults to 14400 (4 hours).

SELECT
id,
attributes,
type
FROM datadog.metrics.tags
WHERE metric_name = '{{ metric_name }}' -- required
AND window[seconds] = '{{ window[seconds] }}'
AND filter[tags] = '{{ filter[tags] }}'
AND filter[match] = '{{ filter[match] }}'
AND filter[include_tag_values] = '{{ filter[include_tag_values] }}'
AND filter[allow_partial] = '{{ filter[allow_partial] }}'
AND page[limit] = '{{ page[limit] }}'
;