Class: Toy::Instrumentation::StatsdSubscriber

Inherits:
Subscriber show all
Defined in:
lib/toy/instrumentation/statsd_subscriber.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Subscriber

call, #initialize, #update

Constructor Details

This class inherits a constructor from Toy::Instrumentation::Subscriber

Class Attribute Details

.clientObject

Returns the value of attribute client.



12
13
14
# File 'lib/toy/instrumentation/statsd_subscriber.rb', line 12

def client
  @client
end

Instance Method Details

#update_timer(metric) ⇒ Object



15
16
17
18
19
# File 'lib/toy/instrumentation/statsd_subscriber.rb', line 15

def update_timer(metric)
  if self.class.client
    self.class.client.timing metric, (@duration * 1_000).round
  end
end