11{
2- "name" : " storefront-tanstack-template" ,
3- "account_id" : " c95fc4cec7fc52453228d9db170c372c" ,
4- "compatibility_date" : " 2026-02-14" ,
5- "compatibility_flags" : [" nodejs_compat" , " no_handle_cross_request_promise_resolution" ],
6- "main" : " ./src/worker-entry.ts" ,
7- "workers_dev" : true ,
8- "preview_urls" : true ,
9- // Uncomment for redirect/AB testing support via KV:
10- // "kv_namespaces": [
11- // { "binding": "SITES_KV", "id": "YOUR_KV_NAMESPACE_ID" }
12- // ],
13- // Strategy B tail worker — 100% capture of producer errors that the
14- // framework's direct-POST channel can't see (uncaught throws, exceededCpu,
15- // exceededMemory, raw console.error). Invoked by CF on every request to
16- // this worker; filters and forwards to deco-otel-ingest via in-account
17- // service binding. See the observability block below for the full
18- // three-channel model.
19- "tail_consumers" : [
20- { "service" : " deco-otel-tail" }
21- ],
22- // Worker version (build SHA / deployment id) — surfaced as
23- // `service.version` on every span / log line by `instrumentWorker`.
24- "version_metadata" : {
25- "binding" : " CF_VERSION_METADATA"
26- },
27- // Cloudflare Analytics Engine dataset for high-cardinality counters
28- // (per-route request counts, cache hit/miss, request duration).
29- // Queryable via SQL from the CF dashboard. Replace YOUR_SITE_NAME with
30- // the actual site slug (must match DECO_SITE_NAME below).
31- // "analytics_engine_datasets": [
32- // {
33- // "binding": "DECO_METRICS",
34- // "dataset": "deco_metrics_YOUR_SITE_NAME"
35- // }
36- // ],
37- // Observability — three-channel model (Strategy B, see decocms/deco-start D-8).
38- //
39- // Identity:
40- // `DECO_SITE_NAME` drives `service.name` on every span and log line.
41- // `DECO_ENV_NAME` drives `deployment.environment`.
42- //
43- // Three channels, each owning a different slice of the observability cube:
44- //
45- // 1. CF Destinations (`observability.{logs,traces}.destinations` below)
46- // Sampled 1% logs + 1% traces. Bulk volume.
47- // 2. Direct-POST in-worker (`DECO_OTEL_*_ENDPOINT`, resolved at
48- // `instrumentWorker` boot)
49- // - METRICS_ENDPOINT → direct POST `/v1/metrics` (CF Destinations
50- // doesn't support OTLP metrics). Buffered per-isolate, flushed
51- // via `ctx.waitUntil` after every request.
52- // - LOGS_ENDPOINT → direct POST `/v1/logs` for framework
53- // `logger.error(...)` only (100% capture, rate-limited).
54- // 3. Tail Worker (`tail_consumers` above → deco-otel-tail)
55- // Catches uncaught throws, exceededCpu/Memory, raw console.error —
56- // what direct-POST can't see and CF Destinations would sample away.
57- //
58- // Coverage matrix:
59- // framework logger.error → direct-POST (100%, rate-limited)
60- // framework span errors → CF Destinations + tail (1% sampled + 100%)
61- // uncaught throws → tail worker (100%)
62- // exceededCpu / exceededMemory → tail worker (100%)
63- // raw console.error → tail worker (100%)
64- // console.log / console.warn → CF Destinations (1% sampled)
65- // OTel spans → CF Destinations (1% sampled)
66- // OTel metrics → direct-POST (100%, buffered)
67- "vars" : {
68- "DECO_SITE_NAME" : " storefront-tanstack" ,
69- "DECO_ENV_NAME" : " production" ,
70- "DECO_OTEL_METRICS_ENDPOINT" : " https://deco-otel-ingest.deco-cx.workers.dev/v1/metrics" ,
71- "DECO_OTEL_LOGS_ENDPOINT" : " https://deco-otel-ingest.deco-cx.workers.dev/v1/logs"
72- },
73- // CF-native observability: structured console.* output and auto-
74- // instrumented traces (fetch/KV/R2/DO subrequests + @opentelemetry/api
75- // global-tracer spans the framework's withTracing() emits) are
76- // captured by the Cloudflare runtime, retained in the CF dashboard
77- // via persist:true, AND forwarded to deco-otel-ingest →
78- // stats-lake ClickHouse via the named destinations below.
79- //
80- // The named destinations are registered out-of-band in the CF
81- // dashboard (Workers & Pages → Observability → Destinations) against
82- // the deco-cx account. Wrangler resolves these names to the URLs +
83- // any auth headers configured there.
84- "observability" : {
85- // Master switch — without enabled:true at the top level CF
86- // captures nothing, regardless of the sub-block flags.
87- "enabled" : true ,
88- "logs" : {
89- "enabled" : true ,
90- "invocation_logs" : true ,
91- // 1% of info/warn logs forward to deco-otel-ingest. Errors are
92- // NOT subject to this rate — they're covered by both the
93- // direct-POST channel (framework logger.error) and the tail
94- // worker (uncaught throws, exceededCpu, raw console.error).
95- "head_sampling_rate" : 0.01 ,
96- "persist" : true ,
97- "destinations" : [" deco-otel-ingest-logs" ]
98- },
99- "traces" : {
100- "enabled" : true ,
101- // Fleet-scale cost discipline — see `@decocms/start`
102- // docs/observability.md "Sampling" section. 1% gives 2.5x
103- // headroom against the 5B-events/day CF cap at projected
104- // fleet traffic.
105- "head_sampling_rate" : 0.01 ,
106- "persist" : true ,
107- "destinations" : [" deco-otel-ingest-traces" ]
108- }
109- }
110- }
2+ "name" : " storefront-tanstack" ,
3+ "account_id" : " c95fc4cec7fc52453228d9db170c372c" ,
4+ "compatibility_date" : " 2026-02-14" ,
5+ "compatibility_flags" : [
6+ " nodejs_compat" ,
7+ " no_handle_cross_request_promise_resolution"
8+ ],
9+ "main" : " ./src/worker-entry.ts" ,
10+ "workers_dev" : true ,
11+ "preview_urls" : true ,
12+ // Uncomment for redirect/AB testing support via KV:
13+ // "kv_namespaces": [
14+ // { "binding": "SITES_KV", "id": "YOUR_KV_NAMESPACE_ID" }
15+ // ],
16+ // Strategy B tail worker — 100% capture of producer errors that the
17+ // framework's direct-POST channel can't see (uncaught throws, exceededCpu,
18+ // exceededMemory, raw console.error). Invoked by CF on every request to
19+ // this worker; filters and forwards to deco-otel-ingest via in-account
20+ // service binding. See the observability block below for the full
21+ // three-channel model.
22+ "tail_consumers" : [
23+ {
24+ "service" : " deco-otel-tail"
25+ }
26+ ],
27+ // Worker version (build SHA / deployment id) — surfaced as
28+ // `service.version` on every span / log line by `instrumentWorker`.
29+ "version_metadata" : {
30+ "binding" : " CF_VERSION_METADATA"
31+ },
32+ // Cloudflare Analytics Engine dataset for high-cardinality counters
33+ // (per-route request counts, cache hit/miss, request duration).
34+ // Queryable via SQL from the CF dashboard. Replace YOUR_SITE_NAME with
35+ // the actual site slug (must match DECO_SITE_NAME below).
36+ // "analytics_engine_datasets": [
37+ // {
38+ // "binding": "DECO_METRICS",
39+ // "dataset": "deco_metrics_YOUR_SITE_NAME"
40+ // }
41+ // ],
42+ // Observability — three-channel model (Strategy B, see decocms/deco-start D-8).
43+ //
44+ // Identity:
45+ // `DECO_SITE_NAME` drives `service.name` on every span and log line.
46+ // `DECO_ENV_NAME` drives `deployment.environment`.
47+ //
48+ // Three channels, each owning a different slice of the observability cube:
49+ //
50+ // 1. CF Destinations (`observability.{logs,traces}.destinations` below)
51+ // Sampled 1% logs + 1% traces. Bulk volume.
52+ // 2. Direct-POST in-worker (`DECO_OTEL_*_ENDPOINT`, resolved at
53+ // `instrumentWorker` boot)
54+ // - METRICS_ENDPOINT → direct POST `/v1/metrics` (CF Destinations
55+ // doesn't support OTLP metrics). Buffered per-isolate, flushed
56+ // via `ctx.waitUntil` after every request.
57+ // - LOGS_ENDPOINT → direct POST `/v1/logs` for framework
58+ // `logger.error(...)` only (100% capture, rate-limited).
59+ // 3. Tail Worker (`tail_consumers` above → deco-otel-tail)
60+ // Catches uncaught throws, exceededCpu/Memory, raw console.error —
61+ // what direct-POST can't see and CF Destinations would sample away.
62+ //
63+ // Coverage matrix:
64+ // framework logger.error → direct-POST (100%, rate-limited)
65+ // framework span errors → CF Destinations + tail (1% sampled + 100%)
66+ // uncaught throws → tail worker (100%)
67+ // exceededCpu / exceededMemory → tail worker (100%)
68+ // raw console.error → tail worker (100%)
69+ // console.log / console.warn → CF Destinations (1% sampled)
70+ // OTel spans → CF Destinations (1% sampled)
71+ // OTel metrics → direct-POST (100%, buffered)
72+ "vars" : {
73+ "DECO_SITE_NAME" : " storefront-tanstack" ,
74+ "DECO_ENV_NAME" : " production" ,
75+ // Fast Deploy opt-in. Requires BOTH this flag AND the DECO_KV binding
76+ // below; inert if either is missing. Set to "0" to disable.
77+ "DECO_FAST_DEPLOY" : " 1" ,
78+ "DECO_OTEL_METRICS_ENDPOINT" : " https://otel-worker.deco.cx/v1/metrics" ,
79+ "DECO_OTEL_LOGS_ENDPOINT" : " https://otel-worker.deco.cx/v1/logs" ,
80+ "DECO_OTEL_TRACES_ENDPOINT" : " https://otel-worker.deco.cx/v1/traces" ,
81+ "DECO_OTEL_TRACES_SAMPLING_RATE" : " 0.01"
82+ },
83+ // CF-native observability: structured console.* output and auto-
84+ // instrumented traces (fetch/KV/R2/DO subrequests + @opentelemetry/api
85+ // global-tracer spans the framework's withTracing() emits) are
86+ // captured by the Cloudflare runtime, retained in the CF dashboard
87+ // via persist:true, AND forwarded to deco-otel-ingest →
88+ // stats-lake ClickHouse via the named destinations below.
89+ //
90+ // The named destinations are registered out-of-band in the CF
91+ // dashboard (Workers & Pages → Observability → Destinations) against
92+ // the deco-cx account. Wrangler resolves these names to the URLs +
93+ // any auth headers configured there.
94+ "observability" : {
95+ // Master switch — without enabled:true at the top level CF
96+ // captures nothing, regardless of the sub-block flags.
97+ "enabled" : true ,
98+ "logs" : {
99+ "enabled" : true ,
100+ "invocation_logs" : true ,
101+ // 1% of info/warn logs forward to deco-otel-ingest. Errors are
102+ // NOT subject to this rate — they're covered by both the
103+ // direct-POST channel (framework logger.error) and the tail
104+ // worker (uncaught throws, exceededCpu, raw console.error).
105+ "head_sampling_rate" : 0.01 ,
106+ "persist" : true ,
107+ "destinations" : [
108+ " deco-otel-ingest-logs"
109+ ]
110+ },
111+ "traces" : {
112+ "enabled" : true ,
113+ // Fleet-scale cost discipline — see `@decocms/start`
114+ // docs/observability.md "Sampling" section. 1% gives 2.5x
115+ // headroom against the 5B-events/day CF cap at projected
116+ // fleet traffic.
117+ "head_sampling_rate" : 0.01 ,
118+ "persist" : true ,
119+ "destinations" : [
120+ " deco-otel-ingest-traces"
121+ ]
122+ }
123+ },
124+ "kv_namespaces" : [
125+ {
126+ "binding" : " DECO_KV" ,
127+ "id" : " a205a78ee28c44c3910cf52a3482a65f" ,
128+ "remote" : true
129+ }
130+ ]
131+ }
0 commit comments