-
Notifications
You must be signed in to change notification settings - Fork 19
Description
π Overview
Monitoring API performance is crucial for ensuring reliability and user satisfaction. Without proper benchmarks, latency issues may go unnoticed, impacting dApps and merchants relying on GasGuard.
This task introduces a Performance Benchmark Module to measure API latency and track key performance indicators like P95 response time.
π― Objective
Build a system that:
- Measures and logs API response times
- Calculates performance metrics, including P95 latency
- Provides historical and real-time performance insights
- Enables developers and operators to monitor and optimize API responsiveness
π Scope of Work
1οΈβ£ Latency Measurement
- Capture request start and end timestamps for all API endpoints
- Measure response times in milliseconds
- Calculate:
- Average (mean) latency
- Median (P50) latency
- 95th percentile (P95) latency
- Maximum and minimum latency
2οΈβ£ Data Aggregation & Storage
-
Store benchmark data in a structured format:
- Endpoint name / path
- Timestamp
- Response time metrics
- Status codes (success / failure)
-
Support historical data retention for trend analysis
-
Optional: store in PostgreSQL or time-series database (e.g., InfluxDB)
3οΈβ£ API & Dashboard Exposure
-
Expose performance metrics via API:
GET /metrics/performance?endpoint=&period=<daily|weekly|monthly>
GET /metrics/performance/:endpoint -
Optional: integrate with dashboards for visualization
-
Support filtering by endpoint, period, and status code
Example JSON response:
{
"endpoint": "/analytics/gas-volatility",
"period": "2026-02",
"p50": 120,
"p95": 250,
"max": 340,
"min": 90,
"totalRequests": 1500
}