Class: Lepus::Prometheus::Instrumentation::QueuePoller
- Inherits:
-
Object
- Object
- Lepus::Prometheus::Instrumentation::QueuePoller
- Defined in:
- lib/lepus/prometheus/instrumentation.rb
Overview
Periodic poller that turns RabbitMQ queue stats into gauge events. Runs in a single thread inside whichever process enabled it.
Class Method Summary collapse
Class Method Details
.running? ⇒ Boolean
100 101 102 |
# File 'lib/lepus/prometheus/instrumentation.rb', line 100 def running? @mutex.synchronize { !@thread.nil? && @thread.alive? } end |
.start(interval:, api:) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/lepus/prometheus/instrumentation.rb', line 89 def start(interval:, api:) @mutex.synchronize do stop_locked @thread = Thread.new { run_loop(interval, api) } end end |
.stop ⇒ Object
96 97 98 |
# File 'lib/lepus/prometheus/instrumentation.rb', line 96 def stop @mutex.synchronize { stop_locked } end |