ExAgent.Observability.ReqLLM.Maintenance (ExAgent v2.2.2)

View Source

Optional application-supervised cleanup of the integrated ReqLLM bridge.

Attach ExAgent.Observability.ReqLLM once after the host SDK is configured, then include this child in the application's supervision tree:

{ExAgent.Observability.ReqLLM.Maintenance,
 ttl_ms: 120_000, interval_ms: 30_000}

Both options are required positive integers in milliseconds. Choose a TTL longer than every allowed live ReqLLM request, including standalone calls, streaming and retries. Pruning is based on age, not process liveness. A shorter TTL can remove a live request's tracking and lose its terminal diagnostics. This child does not configure or enforce the application's request deadlines.

One node-local worker periodically calls ReqLLM's public pruning API for the integrated handler only. It stays dormant when that handler is absent. It never attaches/detaches a bridge, starts an SDK, finishes a span or prunes another handler. Stopping the child leaves the host's tracing configuration intact. The next timer is scheduled after each pass, so scans do not overlap.

stats/0 exposes numeric cleanup counters and a fixed status, without request IDs, content or span data. Counters reset when supervision restarts the worker. ReqLLM scans its matching entries; its transient allocation and the overall table size are not a hard memory bound. Request admission remains host-owned. No child is installed automatically by ExAgent or ExAgent.Observability.ReqLLM.attach/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start the singleton through the application's supervision tree.

Read this worker's counters; returns an error when it is not running.

Types

stats()

@type stats() :: %{
  ticks: non_neg_integer(),
  passes: non_neg_integer(),
  pruned_entries: non_neg_integer(),
  last_pruned_entries: non_neg_integer(),
  status: :waiting | :active | :detached
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(options)

@spec start_link(keyword()) :: GenServer.on_start()

Start the singleton through the application's supervision tree.

stats()

@spec stats() :: stats() | {:error, :not_running | :unavailable}

Read this worker's counters; returns an error when it is not running.