summaryrefslogtreecommitdiff
path: root/lib/gitlab/usage_data_metrics.rb
blob: 8948d621d3c01a8234478d67250925178a2929da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  class UsageDataMetrics
    class << self
      # Build the Usage Ping JSON payload from metrics YAML definitions which have instrumentation class set
      def uncached_data
        build_payload(:with_value)
      end

      private

      def build_payload(method_symbol)
        ::Gitlab::Usage::Metric.all.map(&method_symbol).reduce({}, :deep_merge)
      end
    end
  end
end