Module: Pgbus::Integrations::Appsignal

Defined in:
lib/pgbus/integrations/appsignal.rb,
lib/pgbus/integrations/appsignal/probe.rb,
lib/pgbus/integrations/appsignal/subscriber.rb

Overview

AppSignal integration for pgbus.

Loaded automatically by Pgbus::Engine when the appsignal gem is present and config.appsignal_enabled is true (default). To opt out:

Pgbus.configure do |c|
  c.appsignal_enabled = false
end

The integration:

* Subscribes to pgbus.* ActiveSupport::Notifications and translates
  them into AppSignal background-job transactions and metrics.
* Registers a minutely probe that reports queue depth, DLQ size,
  dead-tuple counts, MVCC horizon age, and stream stats from
  Pgbus::Web::DataSource.

All metric names are prefixed ‘pgbus_` so they group cleanly in AppSignal’s custom-metrics view.

Defined Under Namespace

Modules: Probe, Subscriber

Class Method Summary collapse

Class Method Details

.install!Object

rubocop:disable Naming/PredicateMethod



29
30
31
32
33
34
35
36
37
38
# File 'lib/pgbus/integrations/appsignal.rb', line 29

def install! # rubocop:disable Naming/PredicateMethod
  return false unless defined?(::Appsignal)
  return false if @installed

  Subscriber.install!
  Probe.install! if Pgbus.configuration.appsignal_probe_enabled
  @installed = true
  Pgbus.logger.info { "[Pgbus] AppSignal integration installed" }
  true
end

.installed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/pgbus/integrations/appsignal.rb', line 40

def installed?
  @installed == true
end

.reset!Object

Test hook: tear everything down so a fresh install! can run.



45
46
47
48
49
# File 'lib/pgbus/integrations/appsignal.rb', line 45

def reset!
  Subscriber.reset! if defined?(Subscriber)
  Probe.reset! if defined?(Probe)
  @installed = false
end