Skip to content

feat(mcp): add metrics for MCP #110

@l33t0

Description

@l33t0

Once #109 is merged, add metrics for MCP server health and usage behind the existing metrics feature flag.

Gauges:

  • spacebot_mcp_connections{server_id, agent_id, state} - current connection state
  • spacebot_mcp_tools_registered{server_id, agent_id} - tool count per server

Counters:

  • spacebot_mcp_connection_attempts_total{server_id, agent_id, result} - connect/retry attempts
  • spacebot_mcp_tool_calls_total{server_id, tool_name, agent_id} - tool invocations
  • spacebot_mcp_reconnects_total{server_id, agent_id} - reconnection count

Histograms:

  • spacebot_mcp_connection_duration_seconds{server_id} - time to establish connection
  • spacebot_mcp_tool_call_duration_seconds{server_id, tool_name} - tool call latency

Scope:

  • Instrument McpClient::connect(), connect_with_retry(), and tool call paths
  • Gate behind #[cfg(feature = "metrics")]
  • Include runtime servers from connect_mcp meta-tool

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions