Class: Idempotency::Instrumentation::StatsdListener
- Inherits:
-
Object
- Object
- Idempotency::Instrumentation::StatsdListener
- Defined in:
- lib/idempotency/instrumentation/statsd_listener.rb
Constant Summary collapse
- EVENT_NAME_TO_METRIC_MAPPINGS =
{ Events::CACHE_HIT => 'idempotency_cache_hit_count', Events::CACHE_MISS => 'idempotency_cache_miss_count', Events::LOCK_CONFLICT => 'idempotency_lock_conflict_count' }.freeze
Instance Method Summary collapse
-
#initialize(statsd_client, namespace = nil) ⇒ StatsdListener
constructor
A new instance of StatsdListener.
- #setup_subscriptions ⇒ Object
Constructor Details
#initialize(statsd_client, namespace = nil) ⇒ StatsdListener
Returns a new instance of StatsdListener.
14 15 16 17 |
# File 'lib/idempotency/instrumentation/statsd_listener.rb', line 14 def initialize(statsd_client, namespace = nil) @statsd_client = statsd_client @namespace = namespace end |
Instance Method Details
#setup_subscriptions ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/idempotency/instrumentation/statsd_listener.rb', line 19 def setup_subscriptions EVENT_NAME_TO_METRIC_MAPPINGS.each do |event_name, metric| Idempotency.notifier.subscribe(event_name) do |event| send_metric(metric, event.payload) end end end |