Class: Gitlab::Ci::Runner::Metrics

Inherits:
Object
  • Object
show all
Extended by:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/runner/metrics.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runner_authentication_failure_counterObject



30
31
32
33
34
35
36
37
# File 'lib/gitlab/ci/runner/metrics.rb', line 30

def self.runner_authentication_failure_counter
  strong_memoize(:runner_authentication_failure) do
    name = :gitlab_ci_runner_authentication_failure_total
    comment = 'Runner authentication failure'

    ::Gitlab::Metrics.counter(name, comment)
  end
end

.runner_authentication_success_counterObject



20
21
22
23
24
25
26
27
28
# File 'lib/gitlab/ci/runner/metrics.rb', line 20

def self.runner_authentication_success_counter
  strong_memoize(:runner_authentication_success) do
    name = :gitlab_ci_runner_authentication_success_total
    comment = 'Runner authentication success'
    labels = { runner_type: nil }

    ::Gitlab::Metrics.counter(name, comment, labels)
  end
end

Instance Method Details

#increment_runner_authentication_failure_counterObject



16
17
18
# File 'lib/gitlab/ci/runner/metrics.rb', line 16

def increment_runner_authentication_failure_counter
  self.class.runner_authentication_failure_counter.increment
end

#increment_runner_authentication_success_counter(runner_type: 'unknown_type') ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/gitlab/ci/runner/metrics.rb', line 9

def increment_runner_authentication_success_counter(runner_type: 'unknown_type')
  raise ArgumentError, "unknown runner type: #{runner_type}" unless
    ::Ci::Runner.runner_types.include? runner_type

  self.class.runner_authentication_success_counter.increment(runner_type: runner_type)
end