ExESDB.SubscriptionHealthTracker (ex_esdb v0.11.0)

Centralized tracker for subscription health events received via :ex_esdb_system PubSub.

This module:

  • Subscribes to subscription health events from subscription proxies
  • Maintains current health status for all subscriptions in a store
  • Provides APIs to query subscription health
  • Publishes aggregated health summaries
  • Integrates with the broader ExESDB monitoring system

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets the current health status for all subscriptions in a store.

Gets detailed health information for a specific subscription.

Lists all subscriptions currently being tracked.

Types

health_data()

@type health_data() :: %{
  subscription_name: String.t(),
  current_status: health_status(),
  last_seen: integer(),
  event_count: non_neg_integer(),
  last_event: health_event(),
  error_count: non_neg_integer(),
  last_error: term() | nil
}

health_event()

@type health_event() :: %{
  store_id: atom(),
  subscription_name: String.t(),
  event_type: atom(),
  metadata: map()
}

health_status()

@type health_status() :: :healthy | :degraded | :failed | :registering | :unknown

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_store_health_summary(store_id)

@spec get_store_health_summary(atom()) :: {:ok, map()} | {:error, term()}

Gets the current health status for all subscriptions in a store.

get_subscription_health(store_id, subscription_name)

@spec get_subscription_health(atom(), String.t()) ::
  {:ok, health_data()} | {:error, :not_found}

Gets detailed health information for a specific subscription.

list_tracked_subscriptions(store_id)

@spec list_tracked_subscriptions(atom()) :: {:ok, [String.t()]}

Lists all subscriptions currently being tracked.

start_link(opts)