-
Couldn't load subscription status.
- Fork 365
Resolve ticket #699: Metrics Functionality Improvements #1034
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
Closed
Conversation
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
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
Signed-off-by: Vicky Kuo <[email protected]>
|
Thank you for this PR, will cherry pick this into another PR due to issues with rebase & testing. Great work! |
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.
Metrics Functionality Improvements
Ensure tool executions, resource reads, prompt uses, server interactions: increment execution counters, update lastExecution/lastUsed timestamps, UI: show correct relative time (e.g., '3 minutes ago')
🎯 Summary of Changes
All metrics functionality has been successfully implemented and improved while preserving core functionality.
📊 Improvements Made
1. Tool Execution Metrics
mcpgateway/services/tool_service.py_record_tool_metric()method2. Prompt Usage Metrics
mcpgateway/services/prompt_service.py_record_prompt_metric()methodget_prompt()method to record metrics with try-except-finally structure3. Resource Read Metrics
mcpgateway/services/resource_service.py_record_resource_metric()method4. Server Interaction Metrics
mcpgateway/federation/forward.pyServerMetricimporttimemodule import_record_server_metric()method to ForwardingService class_forward_to_gateway()method to:time.monotonic()5. Python Compatibility Fix
mcpgateway/services/gateway_service.pyexcept*statements not compatible with Python 3.10except*with regularexceptstatements for Python 3.10 compatibility6. UI Time Formatting
🧪 TESTING RESULTS
Automated Test Results
Database Status
🚀 TECHNICAL IMPLEMENTATION DETAILS
1. Prompt Metrics Recording
2. Server Interaction Metrics Recording
3. Integration Points
get_prompt()method ✅read_resource()method ✅_forward_to_gateway()method ✅📋 MANUAL TESTING INSTRUCTIONS
Prerequisites
Testing Steps
NEXT STEPS FOR COMPLETE VERIFICATION
Screen.Recording.2025-09-13.at.11.41.00.PM.mov