Class: Lepus::Consumers::StatsRegistry
- Inherits:
-
Object
- Object
- Lepus::Consumers::StatsRegistry
- Defined in:
- lib/lepus/consumers/stats_registry.rb
Overview
Per-worker registry of consumer stats. Uses Concurrent::Map for thread-safe lazy initialization.
Instance Method Summary collapse
- #all ⇒ Object
- #connection_count ⇒ Object
- #for(consumer_class) ⇒ Object
-
#initialize ⇒ StatsRegistry
constructor
A new instance of StatsRegistry.
Constructor Details
#initialize ⇒ StatsRegistry
Returns a new instance of StatsRegistry.
10 11 12 |
# File 'lib/lepus/consumers/stats_registry.rb', line 10 def initialize @stats = Concurrent::Map.new end |
Instance Method Details
#all ⇒ Object
20 21 22 |
# File 'lib/lepus/consumers/stats_registry.rb', line 20 def all @stats.values.map(&:to_h) end |
#connection_count ⇒ Object
24 25 26 |
# File 'lib/lepus/consumers/stats_registry.rb', line 24 def connection_count @stats.size end |