Add opt-in OpenTelemetry traces and metrics #43
Labels
No labels
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/mcp-beaver#43
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ward-mcp currently emits no application-level traces or metrics. The deployed consumers therefore expose only workload and log-level evidence, even though every guarded call converges on a small set of shared MCP and HTTP handler paths.
OpenTelemetry now defines MCP-native server and client spans, context propagation through
params._meta, andmcp.server.operation.duration/mcp.client.operation.durationmetrics. ward-mcp should implement that contract once in the generic runtime so every spec-backed, SSM, and upstream-proxy consumer inherits it.Reference: https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/mcp.md
Runtime contract
OTEL_*environment variables.OTEL_SDK_DISABLED=true,OTEL_TRACES_EXPORTER=none, andOTEL_METRICS_EXPORTER=none.OTEL_SERVICE_NAMEandOTEL_RESOURCE_ATTRIBUTESoverride or extend it.Signals
MCP server
mcp.method.name.tools/call, setgen_ai.operation.name=execute_tooland the low-cardinalitygen_ai.tool.name.CallToolResultwithisError=truesets span status ERROR anderror.type=tool_error.mcp.server.operation.durationwith the recommended explicit bucket boundaries.params._metaas the remote parent. Link the ambient HTTP transport context when present, as the MCP convention specifies.Upstream proxy client
serve-upstreamemits MCP CLIENT spans andmcp.client.operation.duration.params._meta.Direct HTTP tool API
POST /api/{tool-name}with standard HTTP server telemetry.execute_tool <tool-name>span through the shared tool wrapper.tools/callexecution span./healthzfrom application telemetry noise. Admin endpoints may retain ordinary HTTP telemetry.Safety and cardinality
Implementation anchors
cmd/ward-mcp/main.goowns provider initialization, explicit configuration failure, graceful server shutdown, and bounded provider flush.internal/mcpserver.Server.installCallRewriteis the existing receiving-middleware convergence point for MCP methods.Server.handlerscover both MCP and/api/{tool-name}execution.internal/mcpserver/upstream.goowns upstream client spans and propagation.Acceptance
params._metapropagation without schema or allowlist drift.noneselectors stay no-op.ward exec testandward exec vetpass.docs/FEATURES.mddocument the shipped feature and configuration.Ownership boundary
This issue owns generic runtime instrumentation and the auth-neutral chart contract. Fleet endpoints, service identities, immutable image pins, rollout order, live verification, and rollback remain in
coilyco-bridge/deploy.Fleet rollout, canary order, live verification, and rollback are tracked in coilyco-bridge/deploy#297.