Skip to content

add: 7-day incidence

This adds a 7-day bucket array as data structure to the overall data footprint of the bot.

I decided to go this bucket approach because I didn't want to store all the timestamps and think that storing counts per days is enough. The counts are accumulated when retrieving the stats.

The buckets are shifted based on the days since the last whoops occured. I opted for storing a previous copy of the buckets since the countWhoops function is a destructive operation on the buckets and there is no way to recover the previous value in undo.

I added a default initializer at the fs load function so the arrays are never undefined, especially after the initial update.

A new gauge metric is written to prometheus. I don't know if that's the correct format to use.

The new incidence metric is also displayed on the stats page.

Merge request reports