|
|
3 өдөр өмнө | |
|---|---|---|
| .. | ||
| README.md | 3 өдөр өмнө | |
| api.md | 3 өдөр өмнө | |
| configuration.md | 3 өдөр өмнө | |
| gotchas.md | 3 өдөр өмнө | |
| patterns.md | 3 өдөр өмнө | |
Specialized Workers that consume execution events from producer Workers for logging, debugging, analytics, and observability.
Tail Workers automatically process events from producer Workers (the Workers being monitored). They receive:
console.log/error/warn/debug)ok, exception, exceededCpu, etc.)Key characteristics:
Before using Tail Workers, consider OpenTelemetry:
For batch exports to observability tools (Sentry, Grafana, Honeycomb):
Need observability for Workers?
├─ Batch export to known tools (Sentry/Grafana/Honeycomb)?
│ └─ Use OpenTelemetry export (not Tail Workers)
├─ Custom real-time processing needed?
│ ├─ Aggregated metrics?
│ │ └─ Use Tail Worker + Analytics Engine
│ ├─ Error tracking?
│ │ └─ Use Tail Worker + external service
│ ├─ Custom logging/debugging?
│ │ └─ Use Tail Worker + KV/HTTP endpoint
│ └─ Complex event processing?
│ └─ Use Tail Worker + Durable Objects
└─ Quick debugging?
└─ Use `wrangler tail` (different from Tail Workers)
export default {
async tail(events, env, ctx) {
// Process events from producer Worker
ctx.waitUntil(
fetch(env.LOG_ENDPOINT, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(events),
})
);
}
};