Repository navigation
Document the code mode split behind the vMCP optimizer - #7294
Merged
Merged
Conversation
With the optimizer on, clients only call find_tool and call_tool, so toolhive_mcp_tool_calls never shows execute_tool_script and the documented PromQL split could not see scripts. The optimizer's call_tool counter already labels each call with its target tool, so the split needs no new series: document queries that union the two counters and work with or without the optimizer, and extend the code mode telemetry integration test to cover the optimizer case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7294 +/- ##
==========================================
- Coverage 81.90% 81.89% -0.02%
==========================================
Files 921 921
Lines 93181 93181
==========================================
- Hits 76322 76310 -12
- Misses 16854 16866 +12
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
With the vMCP optimizer on, clients see only
find_toolandcall_tool, sotoolhive_mcp_tool_callslabels every calltool="call_tool"and never showsexecute_tool_script. The code mode split documented for #4744 (shipped in #7275) is therefore blind to scripts on any vMCP that runs the optimizer. The script metrics and the usage report count correctly in that mode; only the documented PromQL split was missing.The optimizer's existing
toolhive_vmcp_optimizer_call_tool_requestscounter already labels eachcall_toolcall with its target astool_name, so the split needs no new series or labels:docs/operator/virtualmcpserver-observability.mdstates which series holds the split with and without the optimizer, and gives PromQL that unions the two counters withor. The queries work for either mode and for a fleet that mixes both, fleet-wide orby (instance). The regular-call side now excludesfind_toolandcall_tool, which the previoustool!="execute_tool_script"query would have counted as regular calls.TestIntegration_CodeModeTelemetrygains an optimizer case: it runs a script and a regular tool throughcall_toolover the real HTTP chain and checks/metricsfortool="call_tool"2 on the request counter andtool_name="execute_tool_script"1 andtool_name="search-svc_search"1 on the optimizer counter, proving the script's inner calls do not reach the optimizer.Completes the split from #4744 for the optimizer case.
Type of change
Test plan
task test)task lint-fix)go test -raceon./pkg/vmcp/server/...passes (integration test also run with-count=5), and golangci-lint v2.15.0 reports 0 issues on the package. Every query in the doc was checked withpromtool test rules(Prometheus v3.5.0) against series shaped like the scraped/metricsoutput: a mixed fleet (one server without the optimizer: 4 scripts and 3 direct calls; one with it: 2find_tool, 1call_toolto a script, 2 to a regular tool) gave 5 scripts, 5 regular calls, share 0.5, and per instance 4/3 and 1/2; a fleet with no optimizer at all gave 4 and 3.Does this introduce a user-facing change?
Documentation only. Before: the documented split queried
toolhive_mcp_tool_calls{tool="execute_tool_script"}, which reads zero on a vMCP with the optimizer on, and countedfind_tool/call_toolas regular calls. After: the documented queries count scripts and regular calls correctly with or without the optimizer. No metric, label or default changes.Special notes for reviewers
oris safe because one vMCP process runs either with or without the optimizer, so each server reports through exactly one of the two series. A new label ontoolhive_mcp_tool_callswould duplicate that.serverattribute, so the per-server split groups by a scrape target label (instance), as the doc says.tool_nameon the optimizer counter is the name the client passed tocall_tool, including unknown names, so its cardinality is bounded by the client, not by the tool catalog. That is pre-existing and unchanged here.🤖 Generated with Claude Code