On 2023-10-03 09:09, 'Jason' via Prometheus Users wrote:
Hi

I will write my query like this (with * wildcad)

sum(http_requests_total{status_code=~"5.+"})

In internet I found this syntax \\d{2}

sum(http_requests_total{status_code=~"5\\d{2}"})

What is this? Where to find more info?
Why I should use the 2nd query and not the first?

In reality both will do the same thing, although the second is technically more correct.

The first regular expression is matching "5" followed by 1 or more other characters, while the second is matching "5" followed by exactly 2 numbers. So the first one would also match "50" or "5frogs" which aren't valid status codes, but in reality your application would have to be having serious problems to be setting those values anyway.

--
Stuart Clark

--
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/1a56f89b81a2f5202b3613d12330b1c8%40Jahingo.com.

Reply via email to