Skip to content

Add namespace viewing catalog logging

What does this MR do and why?

Resolving #397835 (closed)

We want to be able to track the viewing of the catalog by namespaces. We want to know the namespace details.

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-12-04_at_12.36.26 Screenshot_2023-12-04_at_12.33.18 See unique_namespaces_visiting_ci_catalog_monthly and unique_namespaces_visiting_ci_catalog_weekly present in the list.

  1. Check the count of events for
    ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'unique_namespaces_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_namespaces_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_namespaces_visiting_ci_catalog', values: 5, 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_namespaces_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