Support

Datadog Functions

Drop Tags from Metrics

The Drop Tags from Metrics function allows you to reduce the cardinality of custom metrics by specifying what tags to drop. The result is published as a new distribution metric without the dropped tags. You can either drop or keep the original metric.


Usage

  • Operates On: Datadog Metrics
  • Label: Optional
  • Filter: Optional

You should know!

When converting a custom metric to a distribution, Datadog creates 5 metrics for the distribution, avg, count, max, min, sum. This results in billing for 5 distinct metrics. Therefore, it is only advisable to convert custom metrics to distributions for distinct metric reduction if the custom metric in question generates more than 5 distinct metrics. You can view the distinct metrics reported (cardinality) for any metric in the Datadog Metrics Summary. To learn more about distinct metrics reported see Custom Metrics Billing

Required Configuration

  • Metrics: A comma-separated list of metric names, wildcards, and/or regular expressions. Regular expressions should be delimited by /
  • Tag Selection Mode: Remove | Keep: If remove is selected the specified tags are removed and all others are kept. If Keep is selection only the specified tags are kept and all other tags are removed.
  • Tag Selection: A comma-separated list of tag names, wildcards, and/or regular expressions. Regular expressions should be delimited by /
  • Drop original metrics: Drop the original custom metric. This can be useful to compare the results against the original metric, but leaving it on for a long duration will incur increased costs.

Optional Configuration

  • Custom Metric Suffix: Optional suffix to use when generating the new metric name. The new metric name is generated by combining the old name plus the suffix. The suffix defaults to .dist if not specified.

Example

Convert all custom metrics that match the expression *.request.latency to distributions and remove the tag queryParams.

Configuration

  • Metrics: *.request.latency
  • Tag Selection Mode: Remove
  • Tag Selection: queryParams
  • Drop original metrics true

Before

{
	"interval": 10,
	"metric": "api.request.latency",
	"points": [
		{
			"timestamp": 1691692263,
			"value": 127.0
		}
	],
	"tags": [
		"environment:dev",
        "host:api.streamfold.com",
        "path:v1/stats",
        "queryParams:param1=value1&param2=value2"
	],
	"type": 1,
    ...
}

After

{
	"metric": "api.request.latency.dist",
	"points": [
		[
			1691692263,
			[
			    127.0	
			]
		]
	],
	"tags": [
		"environment:dev",
        "host:api.streamfold.com",
        "path:v1/stats"
	],
	"type": "distribution"
}
Previous
Bloblang Code