Skip to content

Add frontend metrics tracking for Threat Insights

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, build on top of backend metrics introduced by Add metrics for Vulnerability Management actions (!129482 - merged) and we add frontend metrics for actions related to groupthreat insights and Category:Vulnerability Management. The actions we track are:

  • Page visits where page_url REGEXP '.*/-/pipelines/[0-9]+/security$' - Page load is tracked from backend, but there's a VueRouter, so clicking on the Security tab after the page is loaded wouldn't be tracked purely by backend
  • Page visits where page_url REGEXP '.*/-/security/configuration$' AND page_url_query REGEXP '.*tab=vulnerability-management.*'

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)

Merge request reports