Push metrics from your applications to automatically detect and respond to health issues.
How It Works
Send metrics like error rates, response times, and resource usage. Kodo analyzes these metrics and automatically updates service status based on configurable thresholds.
Default Thresholds
| Metric | Degraded | Partial Outage | Major Outage |
|---|
| Error rate | >1% | >10% | >50% |
| Response time | >1000ms | >3000ms | >10000ms |
| CPU usage | >70% | >85% | >95% |
| Memory usage | >70% | >85% | >95% |
Pushing Metrics
curl -X POST "https://kodostatus.com/api/v1/metrics/ingest" \
-H "Content-Type: application/json" \
-d '{
"api_key": "your_api_key",
"service": "API Gateway",
"metrics": {
"error_rate": 2.5,
"response_time_ms": 245,
"cpu_percent": 65,
"memory_percent": 78
}
}'
The API key is passed in the body, not as a header. This allows easier integration from environments where headers are difficult to set.
Available Metrics
| Metric | Type | Description |
|---|
error_rate | number | Error percentage (0-100) |
response_time_ms | number | Average response time |
cpu_percent | number | CPU usage (0-100) |
memory_percent | number | Memory usage (0-100) |
request_count | number | Requests in this period |
error_count | number | Errors in this period |
Integration Examples
Node.js
Express Middleware
// Push metrics every minute
setInterval(async () => {
await fetch('https://kodostatus.com/api/v1/metrics/ingest', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: process.env.KODO_API_KEY,
service: 'API Gateway',
metrics: {
error_rate: calculateErrorRate(),
response_time_ms: getAvgResponseTime(),
request_count: getRequestCount()
}
})
});
}, 60000);
const metrics = { requests: 0, errors: 0, totalTime: 0 };
app.use((req, res, next) => {
const start = Date.now();
res.on('finish', () => {
metrics.requests++;
metrics.totalTime += Date.now() - start;
if (res.statusCode >= 500) metrics.errors++;
});
next();
});
// Push every minute
setInterval(() => {
pushMetrics({
error_rate: (metrics.errors / metrics.requests) * 100,
response_time_ms: metrics.totalTime / metrics.requests
});
// Reset counters
metrics.requests = metrics.errors = metrics.totalTime = 0;
}, 60000);
Response
{
"success": true,
"received_at": "2024-01-15T10:30:00Z",
"health_status": "operational",
"alerts": []
}
If thresholds are exceeded:
{
"success": true,
"received_at": "2024-01-15T10:30:00Z",
"health_status": "degraded",
"alerts": [
{
"metric": "error_rate",
"value": 12.5,
"threshold": 10,
"severity": "partial_outage"
}
]
}
Custom Thresholds
Configure custom thresholds per service in the dashboard under Services > [Service] > Metrics.