Skip to content

Add runner CSV export metrics at project and group level

Pedro Pombeiro requested to merge pedropombeiro/467284/add-metrics into master

What does this MR do and why?

This MR adds new runner CSV export events (similar to export_runner_usage_by_project_as_csv) so that it can be tracked at the project and group level. It also adds metrics for the project and group level.

If we have project with full path gitlab-org/gitlab, the goal is to be able to track when this event happened at the gitlab-org group level, and at the gitlab-org/gitlab project level. Not sure how flexible the Tableau querying is, but I imagine that it is not possible to reuse the same event (export_runner_usage_by_project_as_csv, first commit).

Changelog: added

Closes #467284 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

n/a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Follow setup steps from https://docs.gitlab.com/ee/development/internal_analytics/internal_event_instrumentation/local_setup_and_debugging.html

  2. Enable the FF:

    Feature.enabled(:runners_dashboard_for_groups)
  3. Go to http://gdk.test:3000/admin/runners/dashboard and click the Export as CSV button. Check that the counts.count_total_export_runner_usage_by_project_as_csv_monthly and counts.count_total_export_runner_usage_by_project_as_csv_on_instance_monthly metrics have increased by 1.

    metrics = %w[counts.count_total_export_runner_usage_by_project_as_csv_monthly counts.count_total_export_runner_usage_by_project_as_csv_on_instance_monthly redis_hll_counters.count_distinct_namespace_id_from_export_runner_usage_by_project_as_csv_for_group_monthly redis_hll_counters.count_distinct_project_id_from_export_runner_usage_by_project_as_csv_for_project_monthly]; metrics.each { |m| puts "#{m}: #{ServicePingHelpers.get_current_usage_metric_value(m)}" }; nil
    counts.count_total_export_runner_usage_by_project_as_csv_monthly: 17
    counts.count_total_export_runner_usage_by_project_as_csv_on_instance_monthly: 1
    redis_hll_counters.count_distinct_namespace_id_from_export_runner_usage_by_project_as_csv_for_group_monthly: 0
    redis_hll_counters.count_distinct_project_id_from_export_runner_usage_by_project_as_csv_for_project_monthly: 0
    => nil
  4. Go to http://gdk.test:3000/groups/gitlab-org/-/runners/dashboard and click the Export as CSV button. Check that the counts.count_total_export_runner_usage_by_project_as_csv_monthly and redis_hll_counters.count_distinct_namespace_id_from_export_runner_usage_by_project_as_csv_for_group_monthly metrics have increased by 1.

    metrics = %w[counts.count_total_export_runner_usage_by_project_as_csv_monthly counts.count_total_export_runner_usage_by_project_as_csv_on_instance_monthly redis_hll_counters.count_distinct_namespace_id_from_export_runner_usage_by_project_as_csv_for_group_monthly redis_hll_counters.count_distinct_project_id_from_export_runner_usage_by_project_as_csv_for_project_monthly]; metrics.each { |m| puts "#{m}: #{ServicePingHelpers.get_current_usage_metric_value(m)}" }; nil
    
    counts.count_total_export_runner_usage_by_project_as_csv_monthly: 18
    counts.count_total_export_runner_usage_by_project_as_csv_on_instance_monthly: 1
    redis_hll_counters.count_distinct_namespace_id_from_export_runner_usage_by_project_as_csv_for_group_monthly: 1
    redis_hll_counters.count_distinct_project_id_from_export_runner_usage_by_project_as_csv_for_project_monthly: 0
    => nil
Edited by Pedro Pombeiro

Merge request reports

Loading