Graphql count and filter MRs by merged at
What does this MR do?
Filter MRs by merged_at in GraphQL
- Move the filter from
ProductivityAnalyticsFinder
- Expose
merged_after
andmerged_before
arguments in GraphQL
Example:
query {
project(fullPath: "root/metrics") {
id,
fullPath,
name,
mergeRequests(mergedBefore: "2020-08-03", mergedAfter: "202-09-03") {
count
}
}
}
Query
Note: The query is not "new". We already have queries on merged_at
within the ProductivityAnalyticsFinder
and the queries are not very efficient.
SELECT COUNT(*)
FROM "merge_requests"
INNER JOIN "merge_request_metrics" ON "merge_request_metrics"."merge_request_id" = "merge_requests"."id"
WHERE "merge_requests"."target_project_id" = 278964
AND "merge_request_metrics"."merged_at" >= '2020-08-02 22:00:00'
AND "merge_request_metrics"."merged_at" <= '2020-07-02 22:00:00'
Once !37713 (merged) is merged there is a way to make the query significantly faster.
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
Edited by Adam Hegyi