ExESDB.Telemetry (ex_esdb v0.11.0)

Telemetry GenServer for the ExESDB core package.

This module is responsible only for monitoring and observability within the core ex_esdb package. It follows proper separation of concerns by:

  1. Only handling telemetry events from this package
  2. Running as a supervised GenServer for reliability
  3. Broadcasting events through PubSub for external consumption
  4. Maintaining internal metrics and health state

Responsibilities

  • Monitor event store read/write operations
  • Track stream operations and performance
  • Monitor subscription management and delivery
  • Track snapshot operations
  • Monitor gateway worker performance
  • Collect cluster consistency and health metrics

Usage

The telemetry server is automatically started by the ExESDB supervisor. To emit custom events from your code:

ExESDB.Telemetry.emit(:stream_write_start, %{store: :my_store, stream: "my-stream"})
ExESDB.Telemetry.emit(:stream_write_complete, %{store: :my_store, stream: "my-stream", events: 5, duration_us: 1500})

To get current metrics:

ExESDB.Telemetry.get_metrics()
ExESDB.Telemetry.get_health()

Summary

Functions

Returns a specification to start this module under a supervisor.

Emit a telemetry event from application code.

Get current health status.

Get current metrics summary.

Reset metrics counters.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

emit(event_name, metadata \\ %{})

Emit a telemetry event from application code.

get_health()

Get current health status.

get_metrics()

Get current metrics summary.

reset_metrics()

Reset metrics counters.

start_link(opts \\ [])