Slap.SlateDB.Telemetry (slap_slatedb v0.2.0)

Copy Markdown View Source

Emits :telemetry events for one database. Start it after Slap.SlateDB.open/2, usually under the supervisor that owns the database:

{:ok, db} = Slap.SlateDB.open("orders", store: store)
{:ok, _pid} = Slap.SlateDB.Telemetry.start_link(db: db, metadata: %{name: "orders"})

Events, each with the :metadata option as metadata:

  • [:slap, :slatedb, :durable] - %{durable_seq: seq}, when the durable sequence number goes up. Updates are coalesced, as for Slap.SlateDB.subscribe/3.
  • [:slap, :slatedb, :stats] - Slap.SlateDB.stats/1, every :interval ms (default 10,000).
  • [:slap, :slatedb, :closed] - %{}, with :reason added to the metadata (:clean, :fenced, :panic or :unknown), once, when the database closes. The process then stops normally.

Options: :db (required), :metadata (a map, default %{}), :interval. A supervised child uses its database handle as part of its child ID, so one supervisor can run telemetry for multiple databases.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()