Class: Sentry::Metrics::CounterMetric

Inherits:
Metric
  • Object
show all
Defined in:
lib/sentry/metrics/counter_metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ CounterMetric

Returns a new instance of CounterMetric.



8
9
10
# File 'lib/sentry/metrics/counter_metric.rb', line 8

def initialize(value)
  @value = value.to_f
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/sentry/metrics/counter_metric.rb', line 6

def value
  @value
end

Instance Method Details

#add(value) ⇒ Object



12
13
14
# File 'lib/sentry/metrics/counter_metric.rb', line 12

def add(value)
  @value += value.to_f
end

#serializeObject



16
17
18
# File 'lib/sentry/metrics/counter_metric.rb', line 16

def serialize
  [value]
end

#weightObject



20
21
22
# File 'lib/sentry/metrics/counter_metric.rb', line 20

def weight
  1
end