Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Telemetry pipeline — records every tool invocation and ships batches to a configurable HTTP endpoint, even when the call was executed locally.

§Why on the proxy side?

With transparent routing, some tool calls never reach an upstream MCP server. Operators who aggregate usage elsewhere (usage dashboards, billing, audit) still want those invocations to show up somewhere, so the proxy forwards a minimal event payload (no tool arguments, no responses) to the endpoint configured under [proxy.telemetry].endpoint. When no endpoint is configured, the pipeline still buffers events locally but never attempts an upload.

§Back pressure

A single bounded in-memory queue with drop-oldest semantics. We deliberately avoid SQLite here — the queue exists to ride out short connectivity hiccups, not to persist across restarts. If the operator wants durable telemetry they can run the proxy in a supervised process with a writable working directory and a JSONL sink (future extension).

§Scheduling

The uploader flushes whenever either:

  • the buffer reaches batch_size, or
  • batch_interval_secs have elapsed since the last flush attempt.

When the endpoint is unset the pipeline still records events (helpful for CLI debug commands) but never attempts an upload.

Structs§

TelemetryAuth
Authentication credentials used when uploading batches.
TelemetryBatch
Request body shape expected by the backend (documented for the future endpoint).
TelemetryBuffer
Shared event buffer. record() is cheap and lock-bound; clones are light (Arc).
TelemetryEvent
Minimal event payload — intentionally excludes tool arguments and responses.
TelemetryPipeline
The full pipeline — owns the buffer, an uploader, and a background flush task.
TelemetryUploader
Uploader — owns the HTTP client and knows how to ship a batch to endpoint.

Enums§

TelemetryStatus
Status of a single tool invocation.