Expose timeToMerge metrics via GraphQL
What does this MR do and why?
This MR exposes the timeToMerge
value stream analytics metric via GraphQL.
Adding this metric requires us to rearrange the class inheritance structure a bit. For now we only exposed issue-base value streams which has slightly different (more) filter arguments. The MR introduces another base class for the merge request based stages (timeToMerge).
TimeToMergeResolver(new) > BaseMergeRequestStageResolver > BaseMergeRequestResolver(defines MR specific args) > BaseCountResolver
LeadTimeResolver(old) > BaseIssueStageResolver(renamed from BaseStageResolver) > BaseIssueResolver(defines issue specific args) > BaseCountResolver
How to set up and validate locally
- Ensure that you're on ultimate plan
- Seed a new VSA project
- Make some data modifications, so we have merged MRs.
route = Route.find_by_path("vsmg-1702284633/vsmp-1702284633") # path is printed after the seed script runs
project = route.source
project.merge_requests.each { |mr| mr.metrics.update!(merged_at: Time.current) }
project.merge_requests.each(&:touch)
Analytics::CycleAnalytics::DataLoaderService.new(group: project.group, model: MergeRequest).execute
- Log in and run the group-level GraphQL query
{
group(fullPath: "vsmg-1702295464") {
id
flowMetrics {
timeToMerge(from: "2023-07-01", to: "2023-12-12") {
value
identifier
}
}
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #412711 (closed)
Edited by Felipe Artur