Skip to main content

Module mcp_metrics

Module mcp_metrics 

Source
Expand description

Prometheus metrics for the MCP HTTP endpoints.

Tracks request counts, tool call counts, and tool call durations, labeled by endpoint type (agent / developer) and either the JSON-RPC method name or the MCP tool name. The status label is ok for successful calls and the McpRequestError error type (e.g. ToolNotFound, DataProductNotFound) for failures.

Structs§

McpMetrics
Metrics emitted by the MCP HTTP handlers.
ToolCallGuard
RAII guard for a single tools/call invocation. On drop, increments tool_calls_total with the current status and observes tool_call_duration_seconds via the embedded HistogramTimer’s own drop. Designed so that if the surrounding future is dropped before completion (e.g. by tokio::time::timeout), the metric still records with the default "cancelled" status instead of being silently lost.