Skip to content

Use the aggregated tables for duration chart

What does this MR do and why?

Note: the change is behind a feature flag, we plan to enable it for gitlab-org shortly.

Within &6046 (closed), we're reworking how the date-range filter works in Value Stream Analytics. Implementing the new behaviour was impractical using the existing finders (MergeRequestFinder and IssuesFinder) because the date range query could be pointed to arbitrary timestamp columns. The new approach uses aggregated tables where timestamp data is ready to be queried.

This MR re-implements the query for the Value Stream Analytics duration chart to use the new aggregated tables. The query logic is quite similar to the original one, the queried tables are different.

The duration chart feature (available on group-level, ultimate or premium):

image

Query plan

Since we query different kinds of data the count does not need to match.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

How to test it

  1. Enable the feature
    Feature.enable(:use_vsa_aggregated_tables)
  2. Seed a new VSA project
    SEED_CYCLE_ANALYTICS=true SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
  3. The seed script prints the project path, copy it and navigate to the project.
  4. Go to the group.
  5. Go to Analytics > Value Stream
  6. Open the top right dropdown and Create new Value Stream
  7. Add a name and save.
  8. Start rails console and aggregate the data
    group = Group.find(x)
    Analytics::CycleAnalytics::DataLoaderService.new(group:group, model: Issue).execute
    Analytics::CycleAnalytics::DataLoaderService.new(group:group, model: MergeRequest).execute
  9. Load the VSA page again.
  10. Inspecting the duration_-_chart endpoint requests, we should see that the _stage_events tables are being used.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #344802 (closed)

Edited by Adam Hegyi

Merge request reports

Loading