ElixirScope.Capture.EventCorrelator (elixir_scope v0.0.1)

EventCorrelator establishes causal relationships between events in the ElixirScope execution cinema system.

Key responsibilities:

  • Correlate function call entry/exit events using call stacks
  • Correlate message send/receive events
  • Maintain correlation state with automatic cleanup
  • Provide correlation chains for debugging and analysis
  • Track correlation metrics and health status

The correlator uses ETS tables for fast correlation state management:

  • Call stacks per process for function correlation
  • Message registry for message correlation
  • Correlation metadata for tracking and cleanup
  • Correlation links for establishing relationships

Performance targets:

  • <500ns per event correlation
  • Support for 10,000+ events/second
  • Memory-bounded with automatic cleanup

Summary

Functions

Returns a specification to start this module under a supervisor.

Manually triggers cleanup of expired correlations.

Correlates multiple events in batch for better performance.

Correlates a single event, establishing causal relationships.

Gets the correlation chain for a given correlation ID.

Gets correlation metadata for a given correlation ID.

Gets correlation metrics.

Gets the current state (for testing).

Performs a health check.

Starts the EventCorrelator with the given configuration.

Gracefully stops the correlator.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup_expired_correlations(pid)

Manually triggers cleanup of expired correlations.

correlate_batch(pid, events)

Correlates multiple events in batch for better performance.

correlate_event(pid, event)

Correlates a single event, establishing causal relationships.

get_correlation_chain(pid, correlation_id)

Gets the correlation chain for a given correlation ID.

get_correlation_metadata(pid, correlation_id)

Gets correlation metadata for a given correlation ID.

get_metrics(pid)

Gets correlation metrics.

get_state(pid)

Gets the current state (for testing).

health_check(pid)

Performs a health check.

start_link(opts \\ [])

Starts the EventCorrelator with the given configuration.

stop(pid)

Gracefully stops the correlator.