PromQL sum by label over time

I am trying to sum up a counter metric over time and grouped by the label applied. I've tried this

sum  by  (searchTerm)  (bot_guides_failed_total)

but I want to have out in a table form like this:

searchTerm1 : 5

searchTerm2: 1 etc..

I'm new to PromQL so let me know if you need more information form me to help me figure this out.


1 answer

  • answered 2022-04-21 22:48 Sergio Santiago

    You need to use a function to extract the number of searches in a specific time window. E.g:

    sum  by  (increase(searchTerm[5m]))  (bot_guides_failed_total)

    This will give you the number of searchTerm grouped by bot_guides_failed_total in a 5 minutes time window.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum