-
Notifications
You must be signed in to change notification settings - Fork 25
Tips
Often, when you fetch some series, you have top BUCKETIZE
it in order to reduce the datapoint count or apply a reducer later.
Ex:
[ $READ_TOKEN 'os.cpu' {} NOW 1 h ] FETCH
[ SWAP bucketizer.mean 0 5 m 0 ] BUCKETIZE
Let's talk about 0 5 m 0
All the hell happens when you put the three bucketizer parameters in "auto" mode (0 = auto).
So firstly, we will force the starting date, because you know the fetching dates, you can use it to prevent magic determination of BUCKETIZE
function.
Ex:
[ $READ_TOKEN 'os.cpu' {} $now 1 h ] FETCH
[ SWAP bucketizer.mean $now 5 m 0 ] BUCKETIZE
So, the next two parameters must be configured.
You can tell the bucket size and have an auto bucket count, tell the bucket count and have the bucket size in auto, but not both in auto.
If you always want the same amount of points, tou can use $now 0 100
, with it, all series will had 100 datapoints.
If you want a time window instead, use the 2nd parameter $now 5 m 0
, this will produce several 5 minutes buckets.
There is an important thing to take care with this parameter, to respect the Nyquist-Shannon theorem, your bucket size must be at least equal to 2 times your scrapping period.
Ex: you scrappe your metrics every 5 minutes
5 m 2 * 'SCRAPPING_PERIOD' STORE
[ $READ_TOKEN 'os.cpu' {} $now 1 h ] FETCH
[ SWAP bucketizer.mean $now $SCRAPPING_PERIOD 2 m MAX 0 ] BUCKETIZE