Skip to content

Add ci catalog component usage tracking

Kasia Misirli requested to merge 411394/Add_component_usage_tracking into master

What does this MR do and why?

Tracking using ci catalog event: cicd_component_usage.
Feature issue.

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']

See count_cicd_component_usage_monthly and count_cicd_component_usage_weekly present in the list.

  1. Check the count of events for
    ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'cicd_component_usage', start_date: Date.today - 1, end_date: Date.today + 7.days)

  2. Create and use a ci catalog component

  3. Check again the count of events have gone up by one
    ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: 'cicd_component_usage', 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('cicd_component_usage', 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=cicd_component_usage, 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