04 Oct 2024 09:49 AM - last edited on 07 Oct 2024 07:14 AM by MaciejNeumann
Hi All, I have created a timeseries DQL for a dashboard and I have got so far and I'm now stuck. I need it to look like the attached image.
I need it to show the average and maximum response times (using the elapsed field), per 30 seconds on a graph. Below is what I have so far, all I see in my results is one avg and max result (see attached image)
timeseries Response = avg(log.application),by: {elapsedMilliSeconds, content,event.original, application, actionname, sourcecontext, elapsed, timestamp, duration}
, interval:1m
| parse event.original, """LD '@t":' LD:time ',' """
| filter application == "API"
| filter actionname == "ScreeningResultController.Get (NBS.AML.Screening.API)"
| filter sourcecontext == "Serilog.AspNetCore."
| fields application, actionname, sourcecontext, toDouble(elapsed), timestamp, time, duration, elapsed, Response
| summarize round(avg(`toDouble(elapsed)`),decimals:2), round(max(`toDouble(elapsed)`),decimals:2)
| fieldsRename AvgSeconds=`round(avg(\`toDouble(elapsed)\`), decimals:2)`, MaxSeconds=`round(max(\`toDouble(elapsed)\`), decimals:2)`
04 Oct 2024 10:43 AM
Hey @Gib80 ,
Ideally for the line graph to work you need to have two sets of data one is timeframe and the other is the values in timeseries so that it can plot in graph format.
So your output must be having something similar to this.
I could not replicate the exact thing, so I picked up CPU usage metric.
Also, above you have used avg of 'elapsed' metric which would convert the value from timeseries to a single value and ruins the whole purpose.
Hope this helps
04 Oct 2024 11:04 AM
Thanks, that does make sense. I'm not sure how to average the milliseconds on a timeseries..
04 Oct 2024 11:25 AM
You can use something like this if you are trying to plot max and average values for same metric.
timeseries `avg(dt.host.cpu.usage)` = avg(dt.host.cpu.usage), by: { host.name }, interval: 1m
| limit 1
| append [
timeseries `max(dt.host.cpu.usage)` = max(dt.host.cpu.usage), by: { host.name }
| limit 1
]