17 Jul 2025 08:00 PM - edited 17 Jul 2025 08:24 PM
Hello Community,
I am in the process of understanding the use case of bins and the rate function in the timeseries command.
I wrote a small script that sends a random whole number as a custom metric into Dynatrace every 30s. Here are a few example metrics I sent:
Sent: custom.random.whole_number 18 2025-07-17 10:04:25
Sent: custom.random.whole_number 6 2025-07-17 10:04:55
Sent: custom.random.whole_number 60 2025-07-17 10:05:25
Sent: custom.random.whole_number 55 2025-07-17 10:05:56
Sent: custom.random.whole_number 72 2025-07-17 10:06:26
Sent: custom.random.whole_number 71 2025-07-17 10:06:56
Sent: custom.random.whole_number 63 2025-07-17 10:07:26
Sent: custom.random.whole_number 45 2025-07-17 10:07:56
...
...
etc
When I plot the data using the DQL: timeseries avg(custom.random.whole_number) for a 10m time interval (i.e., 10:00 AM to 10:10 AM), I can see that Dynatrace by default uses a 1m bin and takes the average value of each 1m interval. Everything looks fine, e.g., I can see 12 ((18+6)/2), 57.5 ((60+55)/2), etc.
My intention was to show raw data in the graph, so I thought the rate function might help here. I updated it to, avg(custom.random.whole_number, rate:30s)
I was under the impression that the rate function would override the default 1-minute interval with 30s so that I could see the raw data as a result. But unfortunately, I got different results, which were actually half the values from the previous result, i.e., 6, 28.75, etc. This seems like the raw data is divided into each second and then averaged over 30s.
For example, does it work like this?
((18 + 6) / 60) * 30) / 2
Is that how it works?
If yes, is there any way to display the raw data in the timeseries?
Additionally, one more question, if we add the bin function in the DQL like this:
timeseries avg(custom.random.whole_number), bins:24
What exactly does this do?
21 Jul 2025 08:41 PM
Hi there,
The rate parameter just serves to make an adjustment to the data values in case that's needed, using the below formula:
The duration that shall be used to adjust the bin values using the following formula: (binValue / interval) * rate
The bins parameter on the other hand will control how many values you get in your series. For instance, if you query over 1 hour and specify 10 bins, you will get the hour divided up into 10 chunks of six minutes each.
As for the raw data points, I believe you may be out of luck because Dynatrace stores metric data with 1-minute interval granularity, and you would therefore not be able to go any finer than this, no matter what you have in your DQL.
22 Jul 2025 12:44 AM
Hi @marco_irmer, Thank you for your clarification