Skip to content

Add user visiting catalog page logging

What does this MR do and why?

Resolving #397835 (closed)

We want to be able to track the viewing of the catalog by users. We want to know the user details, namespace, catalog resource, user tier and whether its a paid plan.

Followed the latest instrumentation guideline.

How to set up and validate locally

  1. Checkout my branch
  2. Verify the event exist:
service_ping_payload = Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)
service_ping_payload['redis_hll_counters']['pipeline_authoring']

Screenshot_2023-11-23_at_16.41.50 See unique_users_visiting_ci_catalog_monthly and unique_users_visiting_ci_catalog_weekly present in the list.

  1. Check the count of events for
    ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'unique_users_visiting_ci_catalog', start_date: Date.today - 1, end_date: Date.today + 7.days)
  2. Trigger a visit to catalog page
  3. Check again the count of events have gone up by one
    ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'unique_users_visiting_ci_catalog', start_date: Date.today - 1, end_date: Date.today + 7.days)
  4. If you'd like to see the Service Ping payload counters incremented, then you can track a mocked event set to a week ago and then check the Service Ping payload output.
::Gitlab::UsageDataCounters::HLLRedisCounter.track_event('unique_users_visiting_ci_catalog', values: "component_location", time: Date.today - 7.days)
service_ping_payload = Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)
service_ping_payload['redis_hll_counters']['pipeline_authoring']

Once this is merged

you can see the query in: https://metrics.gitlab.com/?q=unique_users_visiting_ci_catalog, and then use that to add a widget to Sisense.

Exisiting pipeline authoring metrics.

MR acceptance checklist

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

Edited by Kasia Misirli

Merge request reports