Class: Amazon::NotificationsHealth

Inherits:
Object
  • Object
show all
Defined in:
app/services/amazon/notifications_health.rb

Overview

Health snapshot of the SP-API notifications pipeline for the CRM monitor
page: SQS queue/DLQ depths, poller heartbeat, and webhook_logs pipeline
state, rolled up into one verdict.

Examples:

Amazon::NotificationsHealth.call
#=> { status: :ok, problems: [], pipeline: {...}, poller: {...}, queues: {...} }

See Also:

Constant Summary collapse

QUEUE_BACKLOG_WARN =

Main-queue backlog above this is a warning (the poller drains ~600/min,
so a persistent backlog means it is down or starved).

500
HEARTBEAT_STALE_AFTER =

The poller cron fires every minute; a heartbeat older than this means
it has stopped running (crashed lock, dead scheduler, missing creds).

10.minutes
RECEIVE_SILENCE_WARN =

Production receives report notifications all day — total silence for
this long suggests subscriptions or delivery broke.

24.hours

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call ⇒ Hash

Returns the full health snapshot (see class docs).

Returns:

  • (Hash) —

    the full health snapshot (see class docs)



27
28
29
# File 'app/services/amazon/notifications_health.rb', line 27

def self.call
  new.call
end

Instance Method Details

#call ⇒ Hash

Returns:

  • (Hash)


32
33
34
35
36
37
# File 'app/services/amazon/notifications_health.rb', line 32

def call
  snapshot = { pipeline: pipeline, poller: poller, queues: queues }
  snapshot[:problems] = problems(snapshot)
  snapshot[:status] = status(snapshot)
  snapshot
end