14 Jul 2021 04:44 PM
I'm trying to "code" a metric query that would only return data points that have a certain response time and count them. If I understand the filter syntax correct then the "series" condition in the :filter transformation should allow me to do that, right?
Example:
This should return the number of requests that are faster than 300ms?
builtin:service."keyRequest".response.server:filter(series(avg,lt,300000)):splitBy():count
But this gives an error:
Illegal transform operator: Usage of :filter(value(...)) requires a previous value extraction.
What exactly is meant by this error, what value extraction?
Does anyone have an example? I'd like to use this for an SLO definition.
Solved! Go to Solution.
15 Jul 2021 08:11 AM - edited 15 Jul 2021 08:14 AM
Hello @r_weber ,
first I don't think you can count individual requests in metric selectors at all. These metrics selectors work on timeseries data only. For counting the individual requests, you need to use the calculated service metrics and then use the metric for SLO for example. I'd also love to have the capability to count number requests with response time condition in the SLO or custom chart without using calculated service metrics, but I don't think this will come anytime soon as it is a different source of information. So filter transformation works on dimensions. So if a metric has multiple dimensions, you can filter on any of them.
Back to your question, you need to specify an aggregation first. So instead of:
builtin:service."keyRequest".response.server:filter(series(avg,lt,300000)):splitBy():count
You need will need:
builtin:service."keyRequest".response.server:count:splitBy():filter(series(avg,lt,300000))
This will give you the number of key requests for which the average response time in the interval is less than 300000 microseconds. I'm not sure if this is the output you want.
I believe you need the number of key requests which are faster than 300000 which is not possible without using calculated metrics.
09 Jun 2023 02:13 PM
Ahoj @Julius_Loman
I hope you are well.
Is it possible to combine two series in a filter? eg. :filter(and(series(avg,gt,10000000)),(series(avg,lt,11000000)))
I got an error message:
Metric selector parse error: Illegal criterion: `(series(avg,lt,11000000))`
I would like to list those services where the avg response time grather then 10 sec and lower then 11 sec. (10 sec time out)
Thanks in advance.
Best regards,
Mizső
09 Jun 2023 11:11 PM
You have the parenthesis placed incorrectly. should be:
filter(and(series(avg,gt,10000000),series(avg,lt,11000000)))
10 Jun 2023 03:45 PM
Ahoj @Julius_Loman,
Many thanks for your help. It works fine.
Best regards,
Mizső