WebsockexNova.Defaults.DefaultMetricsCollector (WebsockexNova v0.1.1)

View Source

Default implementation of the MetricsCollector behavior for WebsockexNova.

Subscribes to all relevant telemetry events and aggregates metrics in ETS tables. Provides a public API for querying metrics (for testing/demo purposes).

All metrics handler API now uses the canonical WebsockexNova.ClientConn struct, with metrics-specific state in the :metrics field.

Metrics Tracked

  • Connection statistics (open/close counts, durations)
  • Message throughput (sent/received count, size, latency)
  • Error metrics (count by category)

Usage

# Start the collector (normally done in your supervision tree)
WebsockexNova.Defaults.DefaultMetricsCollector.start_link([])

# Query metrics (for testing/demo)
WebsockexNova.Defaults.DefaultMetricsCollector.get_metric(:connections_opened)

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

do_handle_connection_event(event, measurements, metadata)

do_handle_error_event(event, measurements, metadata)

do_handle_message_event(event, measurements, metadata)

get_metric(key)

Get a metric by key (for testing/demo).

get_metric(key, default)

handle_telemetry(event, measurements, metadata, config)

start_link(opts)