Monitoring & Observability
Monitor PULSE health and performance
Monitoring & Observability
Monitor PULSE health, performance, and reliability in production.
Health Checks
Basic Health Check
curl https://api.example.com/health
Response:
{
"status": "ok",
"timestamp": 1703001234567
}
Readiness Check
curl https://api.example.com/health/ready
Checks all dependencies:
{
"status": "ready",
"dependencies": {
"database": "ok",
"cache": "ok",
"api_secret_configured": true
}
}
Cloudflare Analytics
PULSE automatically reports to Cloudflare Analytics:
- Go to Cloudflare Dashboard
- Select Workers → Your Worker
- View Analytics:
- Requests — Total API calls
- Latency — p50, p95, p99 response times
- Errors — 4xx and 5xx error rates
- CPU — CPU usage per request
Datadog Integration
Enable Datadog monitoring:
# Set API key
wrangler secret put DATADOG_API_KEY --env production
# Restart worker
wrangler deploy --env production
Key Metrics to Monitor
Performance
| Metric | Target | Alert |
|---|---|---|
| API latency (p95) | <500ms | >1000ms |
| Database latency | <100ms | >200ms |
| Cache hit rate | >80% | <70% |
| Event throughput | >1000/sec | <500/sec |
Reliability
| Metric | Target | Alert |
|---|---|---|
| Error rate | <0.1% | >1% |
| Uptime | 99.99% | <99% |
| Deploy failures | 0% | >0% |
Business
| Metric | Target |
|---|---|
| Events ingested | Trending up |
| Active users | Trending up |
| Query volume | Trending up |
Request Logging
View worker logs:
wrangler tail
Error Tracking
Monitor errors:
try {
// Operation
} catch (error) {
console.error('Error:', {
message: error.message,
stack: error.stack,
context: { requestId, userId, action }
})
}
Alerts
Set up Cloudflare Page Rules to alert on:
- Error rate > 1%
- Latency p95 > 500ms
- Worker CPU > 30ms
- Database latency > 200ms
Tracing
Monitor request flow with X-Request-ID:
const requestId = crypto.randomUUID()
// Include in all logs
console.log(`[${requestId}] Request started`)
Database Monitoring
Monitor D1 performance:
# View D1 usage
wrangler d1 list
# Check database status
curl https://api.example.com/api/v1/stats \
-H "Authorization: Bearer YOUR_API_KEY"
KV Cache Monitoring
Monitor KV usage:
- Go to Cloudflare Dashboard
- KV → View usage
- Monitor:
- Read requests
- Write requests
- Storage used
Next Steps
- Troubleshooting — Resolve issues
- Database Migrations — Update schema
Last updated: April 3, 2026