Extend McpMetricsObserver with completion, error, and tools/list callbacks#1142
Open
psp65 wants to merge 1 commit intosmithy-lang:mainfrom
Open
Extend McpMetricsObserver with completion, error, and tools/list callbacks#1142psp65 wants to merge 1 commit intosmithy-lang:mainfrom
psp65 wants to merge 1 commit intosmithy-lang:mainfrom
Conversation
…/list callbacks Add three new default methods to McpMetricsObserver: - onToolCallComplete: fires after tool execution with latency, server ID, success/failure, and proxy flag - onToolCallError: fires on tool call errors with error message - onToolsList: fires on tools/list requests with tool count Instrument McpService.handleToolsCall() with System.nanoTime() latency tracking on both local and proxy code paths, and add error tracking for failed calls and unknown tools. Instrument handleToolsList() with tool count callback.
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
McpMetricsObserver:onToolCallComplete,onToolCallError, andonToolsListMcpService.handleToolsCall()withSystem.nanoTime()latency tracking on both local and proxy code pathsMcpService.handleToolsList()with tool count callbackonToolCallis now guaranteed a matchingonToolCallComplete, including the "tool not found" error pathMotivation
The existing
McpMetricsObserveronly tracks tool call initiation (onToolCall) and initialization (onInitialize). There is no visibility into:These callbacks enable downstream consumers (e.g., CLI telemetry) to emit per-tool counters, per-server breakdowns, latency timings, and error rates.