Aggregate a metric by avg(response_time) and by amount of item

Hello,

I do have log containing response of each transaction and also quantity of item ordered in the same transaction.

order.id quantity response.time.ms
AB_987 29 10000

Out of those logs I’m building metrics.

What is the best way of building a visual timeseries distribution based on response time and amount of items?
(I’d like to observe if based on amount of item ordered the response time goes high on avg).

Regards

Hi @y_buccellato , you can try something similar to response time by request count? Use line chart for response time and bar for quantity in your case .Hope I understood your query correctly.

timeseries response_time = avg(dt.service.request.response_time), request_count = sum(dt.service.request.count)

Hey @y_buccellato,

Based on what you’re trying to find out you could try using the makeTimeseries command along with binning the order quantity to see if you can find trends that way.

In my example below each timeseries is grouped by the number of items in an order. For example the first group, the blue line, are orders with numbers of items between 0 and 49. The next group, white, is comprised of orders with items between 50 and 99. And so on. This can be modified to suite your needs, you could bin them into smaller groups if the maximum number of items is 50 or 100 or something like that you might bin by 5 or 10.

My example raw data looks like below.

Alternatively you could use makeTimeseries but just split by order quantity if the range of items in orders is fairly low and the number of total orders is high enough to create a nice timeseries.

Hope this helps!

Thank you for your time.

You first example is kinda perfect. And you made me think: maybe while processing the data in a pipeline I can create a log field item.number.category ( less then X, between X and Y, more than Y) and this way the field can later on become a dimension (that doesn’t grow too much) for a possible metric so I make users visualise metrics and not consume logs.

Thank you, this was also an option which I had thought of but the real implementation looks more in the way Fin suggested

Just a small detail here - in the legend: is there any way to not show Bin 0 and then Bin 10; instead showing Bin from 0 to 9, bin from 10 to 19, etc.. ?

Regards

I think you could use the filterOut command or you can remove them from the visualization tab.

You would take the field you’ve put the bin amount into and use some string modifications to change it. As seen below I used concat to add " - #" to the end of each bin amount to show the range.