Skip to content

Migrate event_monthly_active_users_metrics to instrumentation

What does this MR do and why?

This MR completes migration of event_monthly_active_users_metrics service ping metrics family to instrumentation class framework

Resolves #339443 (closed)

Screenshots or screen recordings

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

How to set up and validate locally

In rails console

## enable service ping
ApplicationSetting.current.update(usage_ping_enabled: true)

## Track events
data = {
  action_monthly_active_users_project_repo: Gitlab::UsageDataCounters::TrackUniqueEvents::PUSH_ACTION,
  action_monthly_active_users_design_management: Gitlab::UsageDataCounters::TrackUniqueEvents::DESIGN_ACTION,
  action_monthly_active_users_wiki_repo: Gitlab::UsageDataCounters::TrackUniqueEvents::WIKI_ACTION,
  action_monthly_active_users_git_write: Gitlab::UsageDataCounters::TrackUniqueEvents::GIT_WRITE_ACTION
}

data.each_with_index do |(_,event), idx|
  (idx + 1).times.with_index do |value|
    puts "tracking #{event} with #{value} at #{(3 + value).days.ago}"
    Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event, values: value, time: (3 + value).days.ago)
  end
end

## Collect metrics
payload = ServicePing::BuildPayload.new.execute

payload['usage_activity_by_stage_monthly']['create'].slice(*data.keys)

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 Mikołaj Wawrzyniak

Merge request reports