-
Notifications
You must be signed in to change notification settings - Fork 392
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
Metrics collector - tool calls and requests #934
Metrics collector - tool calls and requests #934
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #934 +/- ##
==========================================
- Coverage 79.95% 79.77% -0.19%
==========================================
Files 292 295 +3
Lines 11898 11965 +67
==========================================
+ Hits 9513 9545 +32
- Misses 2385 2420 +35 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better if we wrote to the file in real time? Instead of having to stop the app to get the metric data?
Metrics collector
AI Description
This pull request introduces a new metrics system to the backend, enabling the collection and export of metrics data. The changes include:
metrics
directory to the.gitignore
file.metrics
directory indocker-compose.yml
.CMD
command insrc/backend/Dockerfile
to specify the port number as8000
.MetricsSettings
class insrc/backend/config/settings.py
for managing metrics-related settings.RequestMetricsMiddleware
andcollector
frombackend.metrics
insrc/backend/main.py
.backend.metrics
module with several new files:__init__.py
: ImportsRequestMetricsMiddleware
,collector
,MONITORED_PATHS
, andtrack_tool_call_time
from thebackend.metrics
package.middleware.py
: Defines theRequestMetricsMiddleware
class for handling metrics collection and theMetricsCollector
class for managing metrics data.tool_call_decorator.py
: Implements thetrack_tool_call_time
decorator for tracking method execution time and logging it to the metrics collector.track_tool_call_time
frombackend.metrics
insrc/backend/tools/base.py
and using it to decorate methods with the metrics collector and parameter checker.