Skip to content

Add agregated metric instrumentation class

What does this MR do and why?

Implements one of the tasks from #370963 (closed)

This MR adds new metric instrumentation class for Aggregated metrics, and migrates first aggregated metric to new framework, to demonstrate implementation in action.

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

How to set up and validate locally

  1. To check just instrumentation class alone:

In rails console

yaml  = <<~YAML
time_frame: 28d
instrumentation_class: AggregatedMetric
data_source: redis_hll
options:
  aggregate:
    operator: OR
    attribute: user_id
  events:
    - 'incident_management_alert_status_changed'
    - 'incident_management_alert_assigned'
YAML

definition = YAML.safe_load(yaml).deep_symbolize_keys

Gitlab::Usage::Metrics::Instrumentations::AggregatedMetric.new(definition).value
  1. To check whole migration

In rails console check if counts_monthly.aggregated_metrics.incident_management_alerts_total_unique_counts metric is present

[1] pry(main)> payload = ServicePing::BuildPayload.new.execute
[2] pry(main)> payload["counts_monthly"]["aggregated_metrics"]["incident_management_alerts_total_unique_counts"]
=> 0

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