| 1 | { |
| 2 | "$schema": "node_modules/wrangler/config-schema.json", |
| 3 | "name": "codewhale-telemetry-ingest", |
| 4 | "main": "src/index.ts", |
| 5 | "compatibility_date": "2025-04-01", |
| 6 | |
| 7 | // Write-only ingest. One POST route, no assets, no KV, no D1, no queues, no |
| 8 | // cron. Nothing here reads back what was written; querying is the SQL API, |
| 9 | // authenticated with the owner's token, out of band. See README.md. |
| 10 | |
| 11 | // Workers Analytics Engine is the only storage. The dataset is created |
| 12 | // implicitly on the first successful `writeDataPoint`, so there is no |
| 13 | // resource to provision ahead of the deploy. |
| 14 | "analytics_engine_datasets": [ |
| 15 | { |
| 16 | "binding": "TELEMETRY", |
| 17 | "dataset": "codewhale_telemetry" |
| 18 | } |
| 19 | ], |
| 20 | |
| 21 | // Per-install rate limiting. Keyed on `install_id` from the validated batch |
| 22 | // body — never on a network address. 20 POSTs per 60s is generous against the |
| 23 | // client's two flush points per session (a startup drain at most once every |
| 24 | // six hours, and one bounded attempt at shutdown). |
| 25 | "ratelimits": [ |
| 26 | { |
| 27 | "name": "RATE_LIMITER", |
| 28 | "namespace_id": "1001", |
| 29 | "simple": { |
| 30 | "limit": 20, |
| 31 | "period": 60 |
| 32 | } |
| 33 | } |
| 34 | ], |
| 35 | |
| 36 | // Invocation logs are OFF deliberately. Cloudflare describes them as |
| 37 | // "enriched with information available to Cloudflare in the context of the |
| 38 | // invocation", which is exactly the class of automatic per-request record |
| 39 | // this service promises not to keep. Nothing in `src/` logs anything either. |
| 40 | // `enabled` stays true so the owner can turn a specific, payload-free metric |
| 41 | // on later without a config archaeology dig. |
| 42 | "observability": { |
| 43 | "enabled": true, |
| 44 | "logs": { |
| 45 | "invocation_logs": false |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | , |
| 50 | // ROUTE. A self-describing hostname on purpose: someone inspecting their own |
| 51 | // network traffic should be able to tell what this is from the name alone. |
| 52 | // An opaque `t.` would have been shorter and would have looked evasive. |
| 53 | "routes": [ |
| 54 | { "pattern": "telemetry.codewhale.net", "custom_domain": true } |
| 55 | ] |
| 56 | // |
| 57 | // `https://telemetry.codewhale.net/v1/telemetry` is the shipped default for |
| 58 | // `telemetry_endpoint` (`DEFAULT_TELEMETRY_ENDPOINT` in |
| 59 | // `crates/config/src/lib.rs`), so real batches arrive here. Only from |
| 60 | // sessions that answered the first-run notice with Enable — the default |
| 61 | // decides where a batch goes, never whether one exists. See README.md. |
| 62 | } |
| 63 |