Class: Gitlab::Ci::Trace::Metrics

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

Constant Summary collapse

OPERATIONS =
[:mutated].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

clear_memoization, strong_memoize, strong_memoized?

Class Method Details

.trace_operationsObject


19
20
21
22
23
24
25
26
# File 'lib/gitlab/ci/trace/metrics.rb', line 19

def self.trace_operations
  strong_memoize(:trace_operations) do
    name = :gitlab_ci_trace_operations_total
    comment = 'Total amount of different operations on a build trace'

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

Instance Method Details

#increment_trace_operation(operation: :unknown) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/gitlab/ci/trace/metrics.rb', line 11

def increment_trace_operation(operation: :unknown)
  unless OPERATIONS.include?(operation)
    raise ArgumentError, 'unknown trace operation'
  end

  self.class.trace_operations.increment(operation: operation)
end