Class: Yabeda::Statsd::Adapter

Inherits:
BaseAdapter
  • Object
show all
Defined in:
lib/yabeda/statsd/adapter.rb

Overview

Adapter for statsd

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection:) ⇒ Adapter

Returns a new instance of Adapter.



12
13
14
# File 'lib/yabeda/statsd/adapter.rb', line 12

def initialize(connection:)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



10
11
12
# File 'lib/yabeda/statsd/adapter.rb', line 10

def connection
  @connection
end

Instance Method Details

#perform_counter_increment!(counter, tags, increment) ⇒ Object



20
21
22
23
# File 'lib/yabeda/statsd/adapter.rb', line 20

def perform_counter_increment!(counter, tags, increment)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.increment(build_name(counter), by: increment, tags: tags)
end

#perform_gauge_set!(gauge, tags, value) ⇒ Object



29
30
31
32
# File 'lib/yabeda/statsd/adapter.rb', line 29

def perform_gauge_set!(gauge, tags, value)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.gauge(build_name(gauge), value, tags: tags)
end

#perform_histogram_measure!(historam, tags, value) ⇒ Object



38
39
40
41
# File 'lib/yabeda/statsd/adapter.rb', line 38

def perform_histogram_measure!(historam, tags, value)
  tags = Yabeda::Statsd::Tags.build(tags)
  connection.histogram(build_name(historam), value, tags: tags)
end

#register_counter!(_) ⇒ Object



16
17
18
# File 'lib/yabeda/statsd/adapter.rb', line 16

def register_counter!(_)
  # We don't need to register metric
end

#register_gauge!(_) ⇒ Object



25
26
27
# File 'lib/yabeda/statsd/adapter.rb', line 25

def register_gauge!(_)
  # We don't need to register metric
end

#register_histogram!(_) ⇒ Object



34
35
36
# File 'lib/yabeda/statsd/adapter.rb', line 34

def register_histogram!(_)
  # We don't need to register metric
end