Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

query metrics on tag value with regex in datadog

I want to filter metrics on tag value with a regex. I can do it in Prometheus but I could not find an equivalent way in Datadog.

For example, to select the following metric whose status tag value starts with 2, I can use the query http.server.requests.count{status=~"^2..$"}

I have the same metric with the same tags in Datadog too, but couldn't find a way to have the same query.

like image 322
Muatik Avatar asked Apr 25 '19 11:04

Muatik


People also ask

Can we filter metrics by tags in Datadog?

By adding tags to your metrics you can observe and alert on metrics from different hardware profiles, software versions, availability zones, services, roles—or any other level you may require.

Is Datadog case sensitive?

Short answer: Unfortunately, no.

What is a Datadog custom metric?

Sending custom metrics to Datadog allows you to monitor important data specific to your business and applications, such as latency, dollars per customer, items bought, or trips taken.

How do you create a metric Datadog?

Creating log-based metrics in Datadog You can create a log-based metric from your log analytics queries by selecting the Generate new Metric option from your graph. Alternatively, navigate to the Generate Metrics tab of the logs configuration section in the Datadog app to create a new query.


Video Answer


1 Answers

Metrics queries now support wildcards.

Example 1: Getting all the requests with a status tag starting with 2: http.server.requests.count{status:2*}

Example 1: Getting all the requests with a service tag ending with mongo: http.server.requests.count{service:*mongo}

Example 3 (advanced): Getting all the requests with a service tag starting with blob and ending with postgres: http.server.requests.count{service:blob*,service:*postgres} (this will match service:blob-foo-postgres and service:blob_bar_postgres but not service:my_name_postgres)

like image 138
XYZ123 Avatar answered Oct 23 '22 08:10

XYZ123