Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements a generalized method for aggregating time-series data.
Data can be aggregated over week or month intervals with a variety of
aggregation methods to choose from.
This will be useful for providing chart views at different levels (such
as two-year periods vs. just showing the last month). Additionally, the
generalized form of aggregation can be used to smooth out graphs where
the sampling frequency changed with an update to Hubble Enterprise.
The aggregation is done by splitting the time data into subsequent,
gapless periods of time (weeks starting with Mondays or months), for
each of which the aggregated values are then computed and returned.
Aggregation methods define how to aggregate the values within individual
time periods. The following aggregation methods are supported:
Additionally, periods at the beginning or the end of the time series may
or may not be included if they are incomplete (there isn’t data for each
day in the period). This is controlled by the setting includeIncomplete,
which supports the following values:
Finally, the pull request usage chart is changed to make use of the new
aggregation facilities to reduce the granularity from daily to monthly
data for now. This might be changed when we implement detail views.
I also added several unit tests to check the aggregation methods (for
off-by-one errors in particular).