Module: Pgbus::Integrations::Appsignal::Probe

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

Overview

Minutely probe that pushes pgbus-wide gauges into AppSignal.

All readings come from Pgbus::Web::DataSource so the probe doesn't duplicate query logic. DataSource is built to be resilient — every method rescues StandardError and returns a safe default — but we still wrap each section in our own rescue so a probe iteration never raises out into the AppSignal probe runner.

Tagging policy: most pgbus metrics are cluster-wide (the queue depth in PostgreSQL is the same regardless of which host reads it), so cluster-wide gauges are emitted WITHOUT a hostname tag — every host sends the same value and AppSignal's last-write-wins semantics keep the dashboard correct. The only gauge that is genuinely per-host is active_processes, which the probe filters to this host before tagging.

Defined Under Namespace

Classes: Runner

Class Method Summary collapse

Class Method Details

.install!Object

rubocop:disable Naming/PredicateMethod



28
29
30
31
32
33
34
# File 'lib/pgbus/integrations/appsignal/probe.rb', line 28

def install! # rubocop:disable Naming/PredicateMethod
  return false if @installed

  ::Appsignal::Probes.register :pgbus, new_probe_instance
  @installed = true
  true
end

.installed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/pgbus/integrations/appsignal/probe.rb', line 36

def installed?
  @installed == true
end

.new_probe_instanceObject

Visible for testing — returns a fresh runnable probe.



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

def new_probe_instance
  Runner.new
end

.reset!Object



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

def reset!
  ::Appsignal::Probes.unregister(:pgbus) if defined?(::Appsignal::Probes) &&
                                            ::Appsignal::Probes.respond_to?(:unregister)
  @installed = false
end