Files
wehub-resource-sync a789495a98
FreeBSD Smoke / FreeBSD Smoke (x86_64) (push) Has been cancelled
CI / Quality Guardrails (push) Has been cancelled
CI / Build & Test (macos-latest) (push) Has been cancelled
CI / Build & Test (ubuntu-latest) (push) Has been cancelled
CI / Build & Test (windows-latest) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / PowerShell Syntax (push) Has been cancelled
CI / Windows Cross-Target Check (Linux) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:34 +08:00

56 lines
2.3 KiB
TOML

name = "jcode-telemetry"
main = "src/worker.js"
compatibility_date = "2025-01-01"
# Custom domain for the website beacon (jcode-website public/beacon.js posts
# here). Managed as a Workers custom domain, so Cloudflare creates the DNS
# record and certificate automatically on deploy.
routes = [
{ pattern = "telemetry.solosystems.dev", custom_domain = true }
]
# Nightly retention prune (see RETENTION_DAYS in src/worker.js). D1 hard-caps
# databases at 500 MB; without pruning, inserts eventually fail with 500s and
# telemetry silently stops being recorded.
[triggers]
crons = ["17 4 * * *"]
[[d1_databases]]
binding = "DB"
database_name = "jcode-telemetry"
database_id = "abaa524c-3e90-4ba9-a569-027e78a083c6"
# High-volume firehose: every event is also written to Workers Analytics
# Engine (time-series store, ~90-day retention, no database size cap). This is
# the primary store for raw turn_end / session_start / onboarding_step
# analysis; D1 keeps only a short raw tail for those events plus the durable
# identity/lifecycle rows and the daily_active_users rollup. The firehose
# write happens before the D1 insert, so telemetry keeps recording even if D1
# hits its size cap. See FIREHOSE_SCHEMA in src/worker.js for column mapping.
#
# ACTION REQUIRED: Analytics Engine needs a one-time enable in the dashboard
# (https://dash.cloudflare.com/9d028e2eacd63c11cbc7df1f9c7a43e4/workers/analytics-engine).
# Until then this binding must stay commented out or `wrangler deploy` fails
# with code 10089. The worker code degrades gracefully without the binding
# (responses report firehose:false). After enabling, uncomment and redeploy.
[[analytics_engine_datasets]]
binding = "FIREHOSE"
dataset = "jcode_telemetry_firehose"
# Web/subscription firehose (FIREHOSE_WEB_SCHEMA in src/worker.js). The main
# FIREHOSE_SCHEMA is at Analytics Engine's 20-blob/20-double capacity, so
# website + subscription events get their own dataset. Same one-time enable
# caveat as above; the worker degrades gracefully without the binding.
[[analytics_engine_datasets]]
binding = "FIREHOSE_WEB"
dataset = "jcode_web_firehose"
# Privacy-safe sponsored-discovery funnel and reliability telemetry. A separate
# dataset avoids repurposing the full main firehose schema.
[[analytics_engine_datasets]]
binding = "FIREHOSE_DISCOVERY"
dataset = "jcode_discovery_firehose"
[vars]
ALLOWED_ORIGIN = "*"