stroom icon indicating copy to clipboard operation
stroom copied to clipboard

Make SQL stats use sensible time buckets

Open at055612 opened this issue 5 years ago • 1 comments

Currently it uses bucket sizes that are powers of 10 millis, i.e.

                    // precision => bucket size
                    // DEFAULT: 0 => 1 ms
                    // HOUR:    6 => 1_000_000 ms (true hour: 3_600_000 ms)
                    // DAY:     7 => 10_000_000 ms (true day: 86_400_000 ms)
                    // MONTH:   9 => 1_000_000_000 ms (true 31day month = 2_678_400_000 ms)

It should be possible to make sql stats work in sensible time buckets, e.g. sec, min, hour, day. This could also be done on a per stat basis, e.g. in the stat entity decide between powers of 10 or sensible time buckets. Thus legacy stat data could be supported and a gradual transition over could happen. It would just need a bit of change to stat aggregation to support both methods of time truncation and the code that subsequently queries it.

at055612 avatar May 15 '20 07:05 at055612

This could possibly be extended to allow offsetting of the time buckets, e.g. to allow for buckets that as not based on UTC days.

Also it may be possible for the stat entity to allow choice of the buckets in use and the age cutoffs for the bucket transitions, e.g. n days at hour granularity, m days at day granularity, etc.

at055612 avatar May 15 '20 08:05 at055612