Skip to content

Apply `without_count: true` to the `group/{id}/audit_events` API

What does this MR do and why?

In #337757 (closed), we added a query to return all of the project audit events under a group in addition to the group-level audit events.

The query appears to work ok, however the COUNT that happens before the query ends up timing out. The problem is the count query attempts to count 10001 rows. That reads 100x more data than the pagination query where we return only 100 rows.

For large datasets, of which the audit_events table qualifies, we usually skip the default behavior of doing a count query

The paginate() method accepts a without_count: true|false flag. We should add a toggle of that flag with a FF.

We want to be able to make sure that whenever audit_event_group_rollup FF is enabled, this is enabled. However we also want to be able to toggle the paginate flag independently

EE: true

Changelog: changed

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before X-Total-* included After X-Total-* removed
image image

How to set up and validate locally

  1. make a verbose (to see headers) curl request
    curl -v \
         --header "PRIVATE-TOKEN: $TOKEN" \
         -H "Content-Type: application/json" \
         -H "Accept: application/json, text/plain, */*" \
         --url "localhost:3000/api/v4/groups/33/audit_events"
  1. observe the calculated X-Total and X-Total-Pages headers are in the response
    1. In rails console enable the experiment fully
    Feature.enable(:audit_event_group_rollup)
  2. make same curl
  3. Observe the calculated X-Total and X-Total-Pages headers are not in the response

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #414578 (closed)

Edited by Michael Becker

Merge request reports

Loading