Class: Twirl::Instrumentation::StatsdSubscriber
- Inherits:
-
Subscriber
- Object
- Subscriber
- Twirl::Instrumentation::StatsdSubscriber
- Defined in:
- lib/twirl/instrumentation/statsd_subscriber.rb
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
Methods inherited from Subscriber
Constructor Details
This class inherits a constructor from Twirl::Instrumentation::Subscriber
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
12 13 14 |
# File 'lib/twirl/instrumentation/statsd_subscriber.rb', line 12 def client @client end |
Instance Method Details
#update_counter(metric, value = 1) ⇒ Object
21 22 23 24 25 |
# File 'lib/twirl/instrumentation/statsd_subscriber.rb', line 21 def update_counter(metric, value = 1) if self.class.client self.class.client.increment metric, value end end |
#update_timer(metric) ⇒ Object
15 16 17 18 19 |
# File 'lib/twirl/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 |