Skip to content

Update snapshot builder

euko requested to merge 381879-update-snapshot-builder into master

Background

The burndown chart (sample: https://gitlab.com/groups/gitlab-org/-/milestones/98#tab-issues) shown in a milestone/iteration (called timebox) report is generated using resource event records:

  • ResourceMilestoneEvent: Issue 1 was added to Milestone A on Date X at 00:00
  • ResourceStateEvent: Issue 1 was closed on Date X at 01:00
  • ResourceStateEvent: Issue 1 was reopened on Date X at 02:00

SnapshotBuilder can produce snapshots of issue states for a timebox using resource event records. SnapshotBuilder is currently behind a non-default feature flag :rollup_timebox_chart and not used in production.

Using the above resource events, the builder can create calculate the ending state of Issue 1 for Milestone A on Date X (and all the dates in the range of the milestone):

  • Snapshot for Milestone A on Date X: Issue 1 was still open at the end of the day on Date X and assigned to Milestone A.

The produced snapshots can used to construct a timeseries for plotting a burnup/down chart for a timebox (the numbers here are random):

Date total weight in milestone total completed issues
Mar 28 3 0
Mar 29 5 1

What does this MR do and why?

  • (change) This MR updates SnapshotBuilder to generate a snapshot for the start date only for a future timebox.

When you view a milestone that starts in the future, you are only interested in the counts/weights assigned to the milestone on the start date which is in the future (think of the milestone 17.2 for example.) The snapshot for the start date would be effectively a projection of the current state.

  • (doc) This MR enhances the documentation of SnapshotBuilder.
  • (refactor) This MR adds a new class (Snapshot) representing a snapshot. Previously, a snapshot was a simple Hash instance. The change is to enforce a weak (but better) data contract among the users/consumers of SnapshotBuilder.

Related to #381879

Edited by euko

Merge request reports