
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
fleet-metrics-cron
Advanced tools
Cloudflare Worker cron that aggregates fleet observability metrics from D1 into KV
Cloudflare Worker that aggregates observability metrics for the SuperInstance fleet of 15 Workers. Runs every 5 minutes via Cron Trigger.
Every 5 minutes, fleet-metrics-cron:
spans and events tables for the last 5-minute window for all 15 fleet workersmetrics:* keys with 10-minute TTL| Key | TTL | Content |
|---|---|---|
metrics:latency:{worker}:{window} | 10 min | Latency percentiles per worker |
metrics:errors:{worker}:{window} | 10 min | Error counts and rates per worker |
metrics:throughput:{worker}:{window} | 10 min | Request counts per worker |
metrics:budget:{window} | 10 min | Budget consumption rates |
metrics:overview:{window} | 10 min | Fleet-wide dashboard summary |
metrics:anomalies:{window} | 10 min | Active anomaly flags |
metrics:baselines | 24 h | 7-day rolling baselines per worker |
Where {window} is an ISO 8601 timestamp truncated to the 5-minute boundary (e.g., 2026-06-10T03:30:00Z).
| Rule | Condition | Severity |
|---|---|---|
| A1 | error_rate > 5% | critical |
| A2 | p95 > 2× baseline | warning |
| A3 | budget drain > 10%/min | critical |
| A4 | error rate > 3× previous window | warning |
| A5 | Worker silent (no spans, was active before) | warning |
| A6 | ≥3 workers degraded simultaneously | critical |
| A7 | p99 > 5× baseline | critical |
| A8 | >10 timeouts in 5-min window | warning |
Each rule has a cooldown to prevent alert storms.
fleet-events with spans and events tables (migrations V006/V007 applied)fleet-orchestrator-kv# Install dependencies
npm install
# Create D1 database (if not already created)
npx wrangler d1 create fleet-events
# → copy database_id into wrangler.toml
# Create KV namespace (if not already created)
npx wrangler kv namespace create fleet-orchestrator-kv
# → copy id into wrangler.toml
# Apply migrations (from the main fleet repo)
npx wrangler d1 execute fleet-events --file=migrations/V006__add_trace_columns.sql
npx wrangler d1 execute fleet-events --file=migrations/V007__create_spans_table.sql
# Local dev with cron trigger simulation
npx wrangler dev --test-scheduled
# Then: curl "http://localhost:8787/__scheduled?cron=*/5+*+*+*+*"
# Type check
npm run typecheck
npm run deploy
# Live tail logs
npm run tail
15 Workers → D1 (spans + events) → fleet-metrics-cron (every 5 min) → KV
↓
Dashboard API
Workers write spans to D1 as fire-and-forget (.run() without await). This cron reads them back in batches of 5 (D1 connection limit), aggregates, and writes to KV for dashboard consumption.
FAQs
Cloudflare Worker cron that aggregates fleet observability metrics from D1 into KV
We found that fleet-metrics-cron demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.