feat(observability): enable full Workers Logs traces (100% sampling)

This commit is contained in:
2026-05-09 12:03:47 +07:00
parent d07f2dbf07
commit 72c420abce
3 changed files with 13 additions and 2 deletions
+3
View File
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Enable Workers Logs with `head_sampling_rate = 1` and `invocation_logs = true` — every cron tick produces a full trace, browsable in the CF dashboard for 3 days.
## [0.1.0] - 2026-05-09
### Added
+1 -1
View File
@@ -135,7 +135,7 @@ The request pins `anthropic-beta: experimental-cc-routine-2026-04-01` (constant
- **Time accuracy**: cron precision on CF Workers is within ~15 seconds — adequate for routine triggering.
- **No retry**: each `/fire` POST creates a new Claude Code session — retrying multiplies sessions and burns quota. The worker logs failures and moves on.
- **Logs**: `wrangler tail` streams live; CF dashboard's "Logs" tab persists them per the observability tier.
- **Logs / traces**: `[observability]` is enabled in `wrangler.toml` with `head_sampling_rate = 1` and `invocation_logs = true` — every invocation produces a structured log + trace, retained per the [Workers Logs retention policy](https://developers.cloudflare.com/workers/observability/logs/workers-logs/) (3 days on the free plan). View live with `npx wrangler tail`, or browse history in the CF dashboard under **Workers & Pages → your worker → Logs**.
- **Cost**: scheduled handlers count against the Workers Free plan's 100k requests/day budget. 5 daily fires × 30 days = 150 requests/month — negligible.
## Security
+9 -1
View File
@@ -19,6 +19,14 @@ crons = [
"0 0-17,22-23 * * *", # UTC+7: 00:00 + 05:00..23:00 hourly
]
# Built-in observability (free tier supports basic logs).
# Workers Logs / traces. `head_sampling_rate = 1` keeps 100% of invocations
# (low volume here — ~20/day — so full retention is free). Drop to e.g. 0.1
# if traffic ever grows enough to matter.
[observability]
enabled = true
head_sampling_rate = 1
[observability.logs]
enabled = true
head_sampling_rate = 1
invocation_logs = true