Skip to content

Add Redis Metric instrumentation class

We currently have

We should add support for RedisMetrics in instrumentation classes

Overview

classDiagram
    BaseMetric --|> DatabaseMetric
    BaseMetric --|> RedisMetric
    BaseMetric --|> RedisHLLMetric
    BaseMetric --|> GenericMetric 

This will likely require code changes similar to the following:

Note: This is a proposal might be other ways to implement this metric class.

class RedisMetric < BaseMetric
  def initialize(time_frame:, options: {})
     super
     raise ArgumentError, "options events are required" unless metric_events.present?
   end

   def metric_events
     options[:events]
   end

   def suggested_name
     # ...
   end

   def value
    redis_usage_data { Gitlab::UsageDataCounters::SourceCodeCounter.read(metric_events) }
   end 
end

counts.source_code_pushes

options:
  events: [pushes]
instrumentation_class: RedisMetric
Edited by Alina Mihaila