Class: Rubino::Metrics::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/metrics.rb

Overview

Thin wrapper binding a metric to a pre-built label set so call sites read cleanly:

Metrics.counter(:foo, label: "x").increment

Instance Method Summary collapse

Constructor Details

#initialize(metric, labels) ⇒ Proxy

Returns a new instance of Proxy.



122
123
124
125
# File 'lib/rubino/metrics.rb', line 122

def initialize(metric, labels)
  @metric = metric
  @labels = labels
end

Instance Method Details

#increment(by: 1) ⇒ Object



127
128
129
# File 'lib/rubino/metrics.rb', line 127

def increment(by: 1)
  @metric.increment(by: by, **@labels)
end

#observe(value) ⇒ Object



131
132
133
# File 'lib/rubino/metrics.rb', line 131

def observe(value)
  @metric.observe(value, **@labels)
end