Armature.MCP.Analytics.Recorder (armature_mcp_analytics v0.1.0)

Copy Markdown View Source

Supervised recorder for Armature MCP analytics events.

:background delivery batches events in this process. :await sends the relevant batch before the record call returns. Neither mode exposes delivery failures to tool handlers.

Summary

Functions

Flushes all queued events.

Records a session initialization once per actor/session pair.

Records one tool call according to the configured delivery mode.

Starts a recorder.

Types

option()

@type option() ::
  {:api_key, String.t() | nil}
  | {:ingest_url, String.t() | nil}
  | {:delivery, :background | :await}
  | {:name, GenServer.name() | nil}
  | {:enabled, boolean()}
  | {:emit, (map() -> :ok | {:error, map()})}
  | {:on_error, (map() -> term())}
  | {:redact_event, (map() -> map() | nil)}
  | {:req_options, keyword()}
  | {:flush_interval_ms, pos_integer()}

Functions

flush(server \\ __MODULE__)

@spec flush(GenServer.server()) :: :ok

Flushes all queued events.

record_session(server \\ __MODULE__, input)

@spec record_session(GenServer.server(), map()) :: :ok

Records a session initialization once per actor/session pair.

record_tool_call(server \\ __MODULE__, input)

@spec record_tool_call(GenServer.server(), map()) :: :ok

Records one tool call according to the configured delivery mode.

start_link(opts)

@spec start_link([option()]) :: GenServer.on_start()

Starts a recorder.