tags
Creates, updates, deletes, gets or lists a tags resource.
Overview
| Name | tags |
| Type | Resource |
| Id | datadog.metrics.tags |
Fields
The following fields are returned by SELECT queries:
- list_tags_by_metric_name
| Name | Datatype | Description |
|---|---|---|
id | string | The metric name for this resource. (example: test.metric.latency) |
attributes | object | Object containing the definition of a metric's indexed and ingested tags. |
type | string | The metric resource type. (metrics) (default: metrics, example: metrics) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_tags_by_metric_name | select | metric_name | window[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[seconds] 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.
| Name | Datatype | Description |
|---|---|---|
metric_name | string | The name of the metric. (example: dist.http.endpoint.request) |
site | string | The 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] | boolean | Whether to allow partial results. Defaults to false. (example: false) |
filter[include_tag_values] | boolean | Whether to include tag values in the response. Defaults to true. (example: true) |
filter[match] | string | Filter returned tags to those matching a substring. For example, filter[match]=env returns tags like env:prod, environment:staging, etc. (example: env) |
filter[tags] | string | Filter results to tags from data points that have the specified tags. For example, filter[tags]=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
- list_tags_by_metric_name
View indexed and ingested tags for a given metric name.<br />Results are filtered by the window[seconds] 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] }}'
;