Class: Flipper::Instrumentation::StatsdSubscriber

Inherits:
Subscriber
  • Object
show all
Defined in:
lib/flipper/instrumentation/statsd_subscriber.rb

Constant Summary

Constants inherited from Subscriber

Flipper::Instrumentation::Subscriber::QUESTION_MARK

Class Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Subscriber

call, #initialize, #strip_trailing_question_mark, #update, #update_adapter_operation_metrics, #update_feature_operation_metrics

Constructor Details

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

Class Attribute Details

.clientObject

Returns the value of attribute client.



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

def client
  @client
end

Instance Method Details

#update_counter(metric) ⇒ Object



21
22
23
24
25
# File 'lib/flipper/instrumentation/statsd_subscriber.rb', line 21

def update_counter(metric)
  if self.class.client
    self.class.client.increment metric
  end
end

#update_timer(metric) ⇒ Object



15
16
17
18
19
# File 'lib/flipper/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