forked from 1jehuang/jcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrangler.toml
More file actions
50 lines (44 loc) · 2.19 KB
/
Copy pathwrangler.toml
File metadata and controls
50 lines (44 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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). jcode.dev is not a zone in this Cloudflare account, so the beacon
# domain lives under solosystems.dev. Managed as a Workers custom domain:
# Cloudflare creates the DNS record and cert 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"
[vars]
ALLOWED_ORIGIN = "*"