Class: Sentry::Yabeda::Collector

Inherits:
ThreadedPeriodicWorker
  • Object
show all
Defined in:
lib/sentry/yabeda/collector.rb

Overview

Periodically calls Yabeda.collect! to trigger gauge collection blocks registered by plugins like yabeda-puma-plugin, yabeda-gc, and yabeda-gvl_metrics.

In a pull-based system (Prometheus), the scrape request triggers collection. In a push-based system (Sentry), we need this periodic worker to drive the collect → gauge.set → adapter.perform_gauge_set! pipeline.

Constant Summary collapse

DEFAULT_INTERVAL =

seconds

15

Instance Method Summary collapse

Constructor Details

#initialize(configuration, interval: DEFAULT_INTERVAL) ⇒ Collector

Returns a new instance of Collector.



18
19
20
21
# File 'lib/sentry/yabeda/collector.rb', line 18

def initialize(configuration, interval: DEFAULT_INTERVAL)
  super(configuration.sdk_logger, interval)
  ensure_thread
end

Instance Method Details

#runObject



23
24
25
26
27
# File 'lib/sentry/yabeda/collector.rb', line 23

def run
  ::Yabeda.collect!
rescue => e
  log_warn("[Sentry::Yabeda::Collector] collection failed: #{e.message}")
end