Skip to content

Add sorting options to value stream analytics

Adam Hegyi requested to merge 321575-add-sorting-to-vsa into master

What does this MR do?

This MR adds sorting capabilities to the Group level Value Stream Analytics feature.

Currently the relevant records are sorted by the configured end event (DESC).

image

Note: the change is not user facing (no changelog). The FE implementation will be covered within this issue: #301082 (closed)

Sorting options:

  • End event ASC/DESC
  • Duration ASC/DESC (end event timestamp - start event timestamp)

How to test it

  1. Seed a new group with VSA: SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
  2. Go to group / analytics/ value stream
  3. Inspect the network requests and find the one with the /records path
  4. Add sort and direction keys: &sort=duration&direction=desc

Database queries

Since Value Stream Analytics events are configurable, it's not possible to measure and get the query plans for all combinations. Generally VSA looks at 1 month of MRs or Issues on the group level and applies additional filters to the query. The relevant rows are read from an index, however the filter and the ORDER BY is not covered by index.

Stage Order Description Plan and Query
Problem Validation End event ASC time between workflow::problem validation label added and removed https://explain.depesz.com/s/KZbV
Problem Validation End event DESC time between workflow::problem validation label added and removed https://explain.depesz.com/s/egwx
Problem Validation Duration ASC time between workflow::problem validation label added and removed https://explain.depesz.com/s/5xeVu
Problem Validation Duration DESC time between workflow::problem validation label added and removed https://explain.depesz.com/s/HhKA
Default plan stage End event ASC time between issue first added to board and issue first mentioned in commit https://explain.depesz.com/s/uads
Default plan stage End event DESC time between issue first added to board and issue first mentioned in commit https://explain.depesz.com/s/QBWL
Default plan stage Duration ASC time between issue first added to board and issue first mentioned in commit https://explain.depesz.com/s/kt8u
Default plan stage Duration DESC time between issue first added to board and issue first mentioned in commit https://explain.depesz.com/s/hu6ey
Default staging stage End event ASC time between mr merged and mr first deployed to prd https://explain.depesz.com/s/WwfA
Default staging stage End event DESC time between mr merged and mr first deployed to prd https://explain.depesz.com/s/1aGW
Default staging stage Duration ASC time between mr merged and mr first deployed to prd https://explain.depesz.com/s/wWBA
Default staging stage Duration DESC time between mr merged and mr first deployed to prd https://explain.depesz.com/s/J3wm

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #321575 (closed)

Edited by Andy Schoenen

Merge request reports