Skip to content

Graphql count and filter MRs by merged at

Adam Hegyi requested to merge graphql-count-and-filter-mrs-by-merged-at into master

What does this MR do?

Filter MRs by merged_at in GraphQL

  • Move the filter from ProductivityAnalyticsFinder
  • Expose merged_after and merged_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'

Plan

Once !37713 (merged) is merged there is a way to make the query significantly faster.

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
Edited by Adam Hegyi

Merge request reports