Monitorex.Storage.Backend behaviour
(monitorex v0.6.0)
Copy Markdown
Behaviour for Monitorex storage backends.
Implementations handle both writing telemetry events and reading/querying stored data. The Collector writes events through the backend; the Storage module reads through it.
Configuring the backend
config :monitorex, :storage_backend, Monitorex.Storage.ETSOr for SQLite:
config :monitorex, :storage_backend, Monitorex.Storage.SQLite
config :monitorex, :sqlite_path, "/var/lib/monitorex/data.db"
Summary
Callbacks
Count recent inbound events matching filters.
Count recent outbound events matching filters.
Fetch a specific event by timestamp.
List consumer aggregates, sorted by requests descending.
List consumer breakdown for a route key.
List endpoint aggregates for a given host.
List all host aggregates, sorted by requests descending.
List recent inbound events with optional filtering.
List recent outbound events with optional filtering.
List route aggregates, sorted by requests descending.
List slow inbound events.
List slow outbound events.
Prune old data (called during Collector cleanup cycle).
Record a single telemetry event.
Callbacks
@callback count_recent_inbound(keyword()) :: non_neg_integer()
Count recent inbound events matching filters.
@callback count_recent_outbound(keyword()) :: non_neg_integer()
Count recent outbound events matching filters.
@callback get_event(integer()) :: Monitorex.Event.t() | nil
Fetch a specific event by timestamp.
@callback list_consumers() :: [map()]
List consumer aggregates, sorted by requests descending.
List consumer breakdown for a route key.
List endpoint aggregates for a given host.
@callback list_hosts() :: [map()]
List all host aggregates, sorted by requests descending.
@callback list_recent_inbound(keyword()) :: [Monitorex.Event.t()]
List recent inbound events with optional filtering.
@callback list_recent_outbound(keyword()) :: [Monitorex.Event.t()]
List recent outbound events with optional filtering.
@callback list_routes() :: [map()]
List route aggregates, sorted by requests descending.
@callback list_slow_inbound(keyword()) :: [Monitorex.Event.t()]
List slow inbound events.
@callback list_slow_outbound(keyword()) :: [Monitorex.Event.t()]
List slow outbound events.
@callback prune() :: :ok
Prune old data (called during Collector cleanup cycle).
@callback record_event(Monitorex.Event.t()) :: :ok
Record a single telemetry event.