-
Notifications
You must be signed in to change notification settings - Fork 206
Instrument vMCP and Document o11y Configuration #2906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d7a51c9
vMCP: Wrap /mcp in Telemetry Middleware
jerm-dro a9a2dd7
Emit Metrics per Backend
jerm-dro c07d3c5
Refactor to plumb telemetry provider into config
jerm-dro f6f8c9b
Move telemetry.go to vmcp/server.go
jerm-dro 3b3a87e
Decorate WorkflowExecutors with Telemetry
jerm-dro 44d9dd6
Move all decoration within vmpcserver
jerm-dro 9313a8a
Expose Metrics on /metrics
jerm-dro 2630bc1
integration test for metrics
jerm-dro d7c0583
Plumb telemetry config from CRD to vMCP Server
jerm-dro 928f70c
Trace BackendClient and Workflow calls
jerm-dro 526223f
Document o11y for vMCP
jerm-dro 402e872
fix lint
jerm-dro 9593ff9
Initial plan
Copilot 0827db0
Fix metric naming inconsistencies and typos
Copilot 67acde4
Generate docs
jerm-dro 11127e2
vMCP CRD uses common spec telemetry type
jerm-dro e9c018b
plumb context to start
jerm-dro 931bbde
bump chart version
jerm-dro 36b8555
bump readme version
jerm-dro b0bedaa
actually bump readme
jerm-dro 2b2d168
Merge branch 'main' into jerm/vmcp-o11y
jhrozek 01f0853
Include telemetry in raw config
jerm-dro 105cd92
update example
jerm-dro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Virtual MCP Server Observability | ||
|
|
||
| This document describes the observability for the Virtual MCP | ||
| Server (vMCP), which aggregates multiple backend MCP servers into a unified | ||
| interface. The vMCP provides OpenTelemetry-based instrumentation for monitoring | ||
| backend operations and composite tool workflow executions. | ||
|
|
||
| For general ToolHive observability concepts and proxy runner telemetry, see the | ||
| main [Observability and Telemetry](../observability.md) documentation. | ||
|
|
||
| ## Overview | ||
|
|
||
| The vMCP telemetry provides visibility into: | ||
|
|
||
| 1. **Backend operations**: Track requests to individual backend MCP servers | ||
| including tool calls, resource reads, prompt retrieval, and capability listing | ||
| 2. **Workflow executions**: Monitor composite tool workflow performance and errors | ||
| 3. **Distributed tracing**: Correlate requests across the vMCP and its backends | ||
|
|
||
| The vMCP uses a decorator pattern to wrap backend clients and workflow executors | ||
| with telemetry instrumentation. This approach provides consistent metrics and | ||
| tracing without modifying the core business logic. | ||
|
|
||
| The implementation of both metrics and traces can be found in `pkg/vmcp/server/telemetry.go`. | ||
|
|
||
| ## Metrics | ||
|
|
||
| The vMCP emits metrics for backend operations and workflow executions. All | ||
| metrics use the `toolhive_vmcp_` prefix. | ||
|
|
||
| **Backend metrics** track requests to individual backend MCP servers, including | ||
| request counts, error counts, and request duration histograms. These metrics | ||
| include attributes identifying the target backend (workload ID, name, URL, | ||
| transport type) and the action being performed (tool call, resource read, etc.). | ||
|
|
||
| **Workflow metrics** track composite tool workflow executions, including | ||
| execution counts, error counts, and duration histograms. These metrics include | ||
| the workflow name as an attribute. | ||
|
|
||
| ## Distributed Tracing | ||
|
|
||
| The vMCP creates spans for each individual backend operation as well as workflow executions, enabling the attribution of workflow execution errors or latency to specific tool calls. | ||
|
|
||
|
|
||
| ## Configuration | ||
|
|
||
| Configure telemetry in the `VirtualMCPServer` resource using the `spec.telemetry` | ||
| field. The telemetry configuration uses the same `TelemetryConfig` type as | ||
| `MCPServer`, providing a consistent configuration experience across resources. | ||
|
|
||
| ```yaml | ||
| apiVersion: toolhive.stacklok.dev/v1alpha1 | ||
| kind: VirtualMCPServer | ||
| metadata: | ||
| name: my-vmcp | ||
| spec: | ||
| groupRef: | ||
| name: my-group | ||
| incomingAuth: | ||
| type: anonymous | ||
| telemetry: | ||
| openTelemetry: | ||
| enabled: true | ||
| endpoint: "otel-collector:4317" | ||
| serviceName: "my-vmcp" | ||
| insecure: true | ||
| tracing: | ||
| enabled: true | ||
| samplingRate: "0.1" | ||
| metrics: | ||
| enabled: true | ||
| prometheus: | ||
| enabled: true | ||
| ``` | ||
|
|
||
| See the [VirtualMCPServer API reference](./virtualmcpserver-api.md) for complete | ||
| CRD documentation. | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [Observability and Telemetry](../observability.md) - Main ToolHive observability documentation | ||
| - [VirtualMCPServer API Reference](./virtualmcpserver-api.md) - Complete CRD specification |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.