Add usage tracking of security policies actions
What does this MR do and why?
This MR is the first step to add Govern SMAU metrics and it adds metrics for two Security Policies actions:
- Visits of Security Policies pages
- Creating of MRs for projects with security policies configuration
The goal is to have metrics for individual actions, aggregate metrics for each of the 5 categories, aggregate metrics for 3 groups within Govern and then aggregated metrics for the entire stage: #414757 (closed)
The MR adds controller concerns to simplify the tracking and to make it consistent, because it will be used for other Govern groups too and it should use current_user.id
as the aggregation value.
How to set up and validate locally
- Visit Secure -> Policies
- Open
rails c
and check that a counter value is updated:
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'users_visiting_security_policies', start_date: Date.current.beginning_of_week, end_date: Date.current.next_week)
- Create a policy, open MR and check that other counter value is updated:
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'users_creating_merge_requests_with_security_policies', start_date: Date.current.beginning_of_week, end_date: Date.current.next_week)
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 #416914 (closed) and #416916 (closed)
Edited by Martin Čavoj