| 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 single bounded flush attempt at shutdown. |
| 24 | "ratelimits": [ |
| 25 | { |
| 26 | "name": "RATE_LIMITER", |
| 27 | "namespace_id": "1001", |
| 28 | "simple": { |
| 29 | "limit": 20, |
| 30 | "period": 60 |
| 31 | } |
| 32 | } |
| 33 | ], |
| 34 | |
| 35 | // Invocation logs are OFF deliberately. Cloudflare describes them as |
| 36 | // "enriched with information available to Cloudflare in the context of the |
| 37 | // invocation", which is exactly the class of automatic per-request record |
| 38 | // this service promises not to keep. Nothing in `src/` logs anything either. |
| 39 | // `enabled` stays true so the owner can turn a specific, payload-free metric |
| 40 | // on later without a config archaeology dig. |
| 41 | "observability": { |
| 42 | "enabled": true, |
| 43 | "logs": { |
| 44 | "invocation_logs": false |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | , |
| 49 | // ROUTE. A self-describing hostname on purpose: someone inspecting their own |
| 50 | // network traffic should be able to tell what this is from the name alone. |
| 51 | // An opaque `t.` would have been shorter and would have looked evasive. |
| 52 | "routes": [ |
| 53 | { "pattern": "telemetry.codewhale.net", "custom_domain": true } |
| 54 | ] |
| 55 | // |
| 56 | // `https://telemetry.codewhale.net/v1/telemetry` is the shipped default for |
| 57 | // `telemetry_endpoint` (`DEFAULT_TELEMETRY_ENDPOINT` in |
| 58 | // `crates/config/src/lib.rs`), so real batches arrive here. Only from |
| 59 | // sessions that have not opted out. v0.9.6 discloses anonymous usage |
| 60 | // counting on first interactive launch and enables it by default. See |
| 61 | // README.md. |
| 62 | } |
| 63 |