From a147aaacc04f478b5cfd1d685c0959013da9e83f Mon Sep 17 00:00:00 2001 From: Anthony Lukach Date: Thu, 19 Nov 2026 22:22:25 -0700 Subject: [PATCH] fix(observability): trim staging telemetry to ~5 GB/month Staging kept every invocation log and traced every request. At ~150k requests/day that was ~4 GB/day (~125 GB/month), as much as production, and the "~5 GB/month" in wrangler.toml and ADR-015 was wrong. From Dec 1, Workers Observability bills ingestion at $0.25/GB past 50 GB, so it is about $30/month. Turn invocation logs off, as in production, and sample traces at 10%. Co-Authored-By: Claude Sonnet 5.5 --- adrs/015-observability.md | 2 ++ wrangler.toml | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/adrs/015-observability.md b/adrs/015-observability.md index 78f8256..1ada20f 100644 --- a/adrs/015-observability.md +++ b/adrs/015-observability.md @@ -54,6 +54,8 @@ Head sampling decides per request before the outcome is known, so it can't keep Production traces are sampled at 1%, about 330k traced requests a day. That's ample for understanding latency and what a request is made of. +Staging keeps every `WARN` and `ERROR` line and has no invocation logs, like production. Its traces are sampled at 10%: staging serves about 150k requests a day, so 1% would leave too few traces to debug with. That comes to about 5 GB a month. + To trace a particular request, the intended mechanism is a zone **Trace Rule** that samples 100% of requests carrying a debug header. `coolnewgeo.com` is on the Free plan, and whether Trace Rules are available there is unverified. ### Query strings are redacted diff --git a/wrangler.toml b/wrangler.toml index d10103a..b6d84bd 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -130,7 +130,10 @@ name = "STS_EXCHANGE_LIMIT" namespace_id = "1002" simple = { limit = 100, period = 60 } -# Staging is ~2M requests/month, so capturing everything costs ~5 GB/month. +# Staging serves ~150k requests/day. Capturing every invocation log and trace +# came to ~4 GB/day (~125 GB/month), as much as production. Invocation logs are +# off, as in production; traces are 10% (production is 1%), because at staging's +# volume 1% is too few traces to debug with. Together ~5 GB/month. [env.staging.observability] enabled = true head_sampling_rate = 1 @@ -143,10 +146,10 @@ enabled = false [env.staging.observability.logs] enabled = true head_sampling_rate = 1 -invocation_logs = true +invocation_logs = false persist = true [env.staging.observability.traces] enabled = true -head_sampling_rate = 1 +head_sampling_rate = 0.1 persist = true