- 
                Notifications
    You must be signed in to change notification settings 
- Fork 366
Prometheus Metrics Instrumentation (Feature #218) #1313
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
Prometheus Metrics Instrumentation (Feature #218) #1313
Conversation
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.
The individual router is functioning correctly; however, documentation for these changes is missing. the router registration in the main application but it was not included the endpoint in the OpenAPI schema so it appears in Swagger UI.
8ddbed7    to
    805e7ef      
    Compare
  
    | Updated the document and include the endpoint in the OpenAPI schema so it appears in Swagger UI. | 
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.
Updated the document and modify the code to include the endpoint in the OpenAPI schema so it appears in Swagger UI.
PR is ready to merge.
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Signed-off-by: rakdutta <[email protected]>
Add comprehensive documentation for Prometheus metrics configuration variables to .env.example: - ENABLE_METRICS: Toggle metrics collection (default: true) - METRICS_EXCLUDED_HANDLERS: Regex patterns for endpoint exclusion - METRICS_NAMESPACE: Metrics name prefix (default: "default") - METRICS_SUBSYSTEM: Secondary metrics prefix - METRICS_CUSTOM_LABELS: Static labels for app_info gauge Includes examples, security warnings about high-cardinality labels, and formatting consistent with existing configuration sections. Related to PR #1313 Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
805e7ef    to
    6c829fc      
    Compare
  
    
🎯 Goal
Enable unified Prometheus-compatible metrics across all FastAPI services for observability, SLO tracking, and proactive alerting.
🧩 Key Changes
mcpgateway/services/metrics.pyto configure Prometheus metrics instrumentation usingprometheus-fastapi-instrumentator.http_requests_total: Request count by method, endpoint, and status code.http_request_duration_seconds: Latency histogram (buckets: 0.05, 0.1, 0.3, 1, 3, 5).http_request_size_bytesandhttp_response_size_bytes: Request and response size histograms./metrics/prometheus.app_infogauge withMETRICS_CUSTOM_LABELSfor cluster-level filtering.METRICS_EXCLUDED_HANDLERSregex.ENABLE_METRICS(default: true)METRICS_EXCLUDED_HANDLERSMETRICS_NAMESPACE,METRICS_SUBSYSTEMMETRICS_CUSTOM_LABELS⚙️ Env Example
✅ Acceptance Criteria
/metrics/prometheusreturns 200 OK and includes standard Prometheus metrics.🧪 Testing
Unit and E2E tests added for: