Welcome to mirror list, hosted at ThFree Co, Russian Federation.

operating_system_metric.rb « instrumentations « metrics « usage « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9bfe12d8ead35c7e0e74c83fe0f58a6d2b6412d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Gitlab
  module Usage
    module Metrics
      module Instrumentations
        class OperatingSystemMetric < GenericMetric
          value do
            ohai_data = Ohai::System.new.tap do |oh|
              oh.all_plugins(['platform'])
            end.data

            platform = ohai_data['platform']
            if ohai_data['platform'] == 'debian' && ohai_data['kernel']['machine']&.include?('armv')
              platform = 'raspbian'
            end

            "#{platform}-#{ohai_data['platform_version']}"
          end
        end
      end
    end
  end
end