Get Connection Metrics
Sprint 3
Get connection metrics for monitoring, including cache statistics, connection counts, pool utilization, and circuit breaker states.
Endpoint
GET /api/v1/data-sources/metrics
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Response
Success (200)
{
"success": true,
"data": {
"connections": {
"active": 15,
"idle": 5,
"total": 20
},
"queries": {
"total_executed": 1250,
"successful": 1245,
"failed": 5,
"avg_execution_time_ms": 125
},
"pools": {
"postgresql": {
"size": 5,
"active": 3,
"idle": 2
},
"mysql": {
"size": 3,
"active": 2,
"idle": 1
}
},
"ssh_tunnels": {
"active": 2,
"total": 2
},
"cache": {
"connection_managers": 10,
"cache_hits": 850,
"cache_misses": 150
},
"connection_limits": {
"max_connections": 100,
"current_connections": 20,
"available": 80
},
"circuit_breakers": {
"postgresql_db1": {
"state": "closed",
"failure_count": 0,
"last_failure": null
}
}
},
"message": "Connection metrics retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 500 | INTERNAL_SERVER_ERROR | Failed to retrieve metrics |
Features
- Connection statistics (active, idle, total)
- Query execution metrics
- Connection pool utilization by data source type
- SSH tunnel statistics
- Cache performance metrics
- Connection limit tracking
- Circuit breaker states
Example
curl -X GET "https://api.rivergen.com/api/v1/data-sources/metrics" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Get Health - Get health status for specific data source
- List Data Sources - List all data sources