ExESDBCommandedAdapter.Telemetry (ex_esdb_commanded v0.9.0)

Telemetry GenServer for the ExESDB Commanded Adapter package.

This module is responsible only for monitoring and observability within the ex_esdb_commanded_adapter 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 command processing and event appending
  • Track aggregate lifecycle and state management
  • Monitor subscription proxy operations
  • Track event acknowledgment and delivery
  • Monitor adapter initialization and lifecycle
  • Collect command/event sourcing performance metrics

Usage

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

ExESDBCommandedAdapter.Telemetry.emit(:command_handled, %{aggregate_id: "123", command: MyCommand, duration_us: 1500})
ExESDBCommandedAdapter.Telemetry.emit(:event_appended, %{stream: "account-123", events: 2})

To get current metrics:

ExESDBCommandedAdapter.Telemetry.get_metrics()
ExESDBCommandedAdapter.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 \\ [])