Add sorting options to value stream analytics
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).
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
- Seed a new group with VSA:
SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
- Go to group / analytics/ value stream
- Inspect the network requests and find the one with the
/records
path - Add
sort
anddirection
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
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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)