Skip to content

Draft: Add metrics for Threat Insights actions

What does this MR do and why?

This MR is related to Govern SMAU Metric (#414757 - closed). 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.

In this MR specifically, we add metrics for actions related to groupthreat insights. It touches many files, but the most lines are added in the YAML definitions and it's all essentially the same change - using an existing concern to track a page visit in a controller. The actions we want to track are:

Vulnerability Management Category

  • Page visits where page_url REGEXP '.*/-/security/vulnerability_report$'
  • Page visits where page_url REGEXP '.*/-/security/dashboard$'
  • Page visits where page_url REGEXP '.*/-/security/vulnerabilities$'
  • Page visits where page_url REGEXP '.*/-/security/vulnerabilities/[0-9]+'
  • Page visits where page_url REGEXP '.*/-/pipelines/[0-9]+/security$'
  • Page visits where page_url REGEXP '.*/-/security/dashboard/settings$'
  • Page visits where page_url REGEXP '.*/-/security/configuration$' AND page_url_query REGEXP '.*tab=vulnerability-management.*' This will be covered in another MR targeting only frontend tracking
  • Any user who expands the Security MR Widget.

Dependency Management Category

  • Page visits where page_url REGEXP '.*/-/dependencies$'
  • Page visits where page_url REGEXP '.*/-/licenses$'

How to set up and validate locally

  1. Visit any of the above-mentioned pages
  2. Open rails c and check that a counter value is updated:
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: '<event-name>', 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.

Related to #416915 (closed)

Edited by Martin Čavoj

Merge request reports