wrangler.jsonc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // codegraph telemetry ingest — see README.md and docs/design/telemetry.md.
  2. // Secrets are NOT configured here: POSTHOG_KEY is set via `wrangler secret put POSTHOG_KEY`.
  3. {
  4. "$schema": "node_modules/wrangler/config-schema.json",
  5. "name": "codegraph-telemetry",
  6. "main": "src/index.ts",
  7. "compatibility_date": "2026-06-12",
  8. "compatibility_flags": ["nodejs_compat"],
  9. // First-party endpoint. The custom domain auto-provisions DNS + cert when the
  10. // getcodegraph.com zone is on the deploying account. workers.dev stays off so
  11. // the only public surface is the documented one.
  12. "routes": [{ "pattern": "telemetry.getcodegraph.com", "custom_domain": true }],
  13. "workers_dev": false,
  14. "observability": { "enabled": true, "head_sampling_rate": 1 },
  15. // Non-secret config. Swap host here if the backend ever moves (EU, self-hosted…).
  16. "vars": { "POSTHOG_HOST": "https://us.i.posthog.com" },
  17. // Telemetry storage. Schema + the chart each table serves: migrations/0001_init.sql.
  18. // Apply with `npm run db:migrate:local` (local state) / `npm run db:migrate` (remote).
  19. // The admin dashboard worker binds this same database read-mostly, also as `DB`.
  20. "d1_databases": [
  21. {
  22. "binding": "DB",
  23. "database_name": "codegraph-telemetry",
  24. "database_id": "5ed36dfb-d2d7-4e35-9e63-a1b99d0b1ed3",
  25. "migrations_dir": "migrations"
  26. }
  27. ],
  28. // Per-machine_id rate limit. Legit clients flush a handful of times per day;
  29. // 6/min absorbs install+index bursts while capping abuse.
  30. "ratelimits": [
  31. {
  32. "name": "MACHINE_RATE_LIMITER",
  33. "namespace_id": "1001",
  34. "simple": { "limit": 6, "period": 60 }
  35. }
  36. ]
  37. }