Class: Karafka::Web::Tracking::Consumers::Sampler::Metrics::Server
- Defined in:
- lib/karafka/web/tracking/consumers/sampler/metrics/server.rb
Overview
Collects Karafka server state metrics (listeners, workers, status)
Instance Method Summary collapse
-
#listeners ⇒ Hash
Number of active and standby listeners.
-
#workers ⇒ Integer
Number of threads that process work.
Instance Method Details
#listeners ⇒ Hash
Returns number of active and standby listeners.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/karafka/web/tracking/consumers/sampler/metrics/server.rb', line 12 def listeners if Karafka::Server.listeners active = Karafka::Server.listeners.count(&:active?) total = Karafka::Server.listeners.count.to_i { active: active, standby: total - active } else { active: 0, standby: 0 } end end |
#workers ⇒ Integer
Returns number of threads that process work.
24 25 26 |
# File 'lib/karafka/web/tracking/consumers/sampler/metrics/server.rb', line 24 def workers Karafka::App.config.concurrency end |