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
Constant Summary collapse
- DASHBOARD_PATH =
File.("appsignal/dashboard.json", __dir__).freeze
- DASHBOARDS_DIR =
File.("appsignal/dashboards", __dir__).freeze
Class Method Summary collapse
- .dashboard_definition ⇒ Object
- .dashboard_definitions ⇒ Object
-
.install! ⇒ Object
rubocop:disable Naming/PredicateMethod.
- .installed? ⇒ Boolean
-
.reset! ⇒ Object
Test hook: tear everything down so a fresh install! can run.
Class Method Details
.dashboard_definition ⇒ Object
48 49 50 |
# File 'lib/pgbus/integrations/appsignal.rb', line 48 def dashboard_definition @dashboard_definition ||= JSON.parse(File.read(DASHBOARD_PATH)) end |
.dashboard_definitions ⇒ Object
52 53 54 55 56 57 |
# File 'lib/pgbus/integrations/appsignal.rb', line 52 def dashboard_definitions @dashboard_definitions ||= Dir[File.join(DASHBOARDS_DIR, "*.json")].map do |path| JSON.parse(File.read(path)) end end |
.install! ⇒ Object
rubocop:disable Naming/PredicateMethod
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pgbus/integrations/appsignal.rb', line 33 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
44 45 46 |
# File 'lib/pgbus/integrations/appsignal.rb', line 44 def installed? @installed == true end |
.reset! ⇒ Object
Test hook: tear everything down so a fresh install! can run.
60 61 62 63 64 65 66 |
# File 'lib/pgbus/integrations/appsignal.rb', line 60 def reset! Subscriber.reset! if defined?(Subscriber) Probe.reset! if defined?(Probe) @installed = false @dashboard_definition = nil @dashboard_definitions = nil end |