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
- Checkout my branch
- Verify the event exist:
service_ping_payload = Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)
service_ping_payload['redis_hll_counters']['pipeline_authoring']
See
unique_users_visiting_ci_catalog_monthly
and unique_users_visiting_ci_catalog_weekly
present in the list.
- 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)
- Trigger a visit to catalog page
- 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)
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Kasia Misirli