cloudflare-workers-observability
Cloudflare Workers Observability equips you with structured logging, custom metrics via Analytics Engine, real-time log streaming through Tail Workers, and alerting capabilities for production deployments. The skill covers critical patterns for request context tracking, sensitive data redaction, log sampling, and error prevention across all observability components.
Cloudflare Workers Observability provides structured logging, metrics, tracing, and alerting for production Cloudflare Workers.
AI-generated summary based on this skill's SKILL.md
Install
secondsky/claude-skills/cloudflare-workers-observability · repository language: TypeScript
git clone https://github.com/secondsky/claude-skills
cp -r claude-skills/plugins/cloudflare-workers/skills/cloudflare-workers-observability ~/.claude/skills/cloudflare-workers-observabilitynpx skillfed install secondsky/claude-skills/cloudflare-workers-observabilityFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up structured logging and monitoring for Cloudflare Workers?
Cloudflare Workers Observability provides structured logging setup through multiple channels. Start by instrumenting your worker code with console methods (log, error, warn) and use Analytics Engine to capture custom metrics. Implement request context tracking to correlate logs across your worker pipeline. Configure Tail Workers to stream logs in real-time to external services like Datadog or Splunk. Apply log sampling for high-volume scenarios and redact sensitive data before transmission to maintain security compliance.
What's the best way to debug cloudflare workers in production?
Cloudflare Workers Observability enables production debugging through request tracing and real-time log inspection. Use Tail Workers to tail worker log aggregation and observe request flows as they happen. Implement structured logging with request IDs to trace individual requests through your worker chain. Add error tracking with detailed stack traces and context. The skill covers patterns for capturing request metadata, response codes, and timing information to pinpoint failures without redeploying code.
How can I aggregate logs and metrics from multiple workers?
Cloudflare Workers Observability supports log aggregation through Tail Workers, which stream logs from all your workers to centralized platforms. Use Analytics Engine to collect custom metrics and performance data across your worker fleet. Implement a consistent logging schema across workers so aggregated logs are queryable and parseable. Configure your external logging service to ingest these streams and create dashboards that correlate metrics across multiple worker instances.
How do I see cloudflare worker logs and set up error alerts?
Cloudflare Workers Observability provides multiple log visibility options. Access real-time logs via the Cloudflare dashboard or use Tail Workers for streaming log aggregation to external services. For error alerting, configure threshold-based alerts on error rates and exception patterns. The skill covers error detection patterns that capture failures early and route alerts to your incident management system. Combine structured logging with Analytics Engine metrics to trigger alerts on performance degradation or anomalies.
What observability patterns does this skill cover for production deployments?
Cloudflare Workers Observability covers critical production patterns including request context tracking for end-to-end visibility, sensitive data redaction to protect PII, log sampling to manage volume at scale, and error prevention strategies. The skill teaches tracing and monitoring best practices, custom business metrics collection, and performance analytics setup. It includes alerting configuration for worker failures and provides guidance on integrating with external observability platforms for comprehensive production visibility.
Can I track custom business metrics with Cloudflare Workers?
Cloudflare Workers Observability includes custom metrics tracking via Analytics Engine, enabling you to capture business-specific KPIs alongside infrastructure metrics. Define custom dimensions and measurements relevant to your application—conversion rates, user actions, API response times—and query them through the Analytics Engine dashboard. The skill demonstrates how to structure metric payloads, sample data efficiently, and correlate custom metrics with request tracing for complete observability of both technical and business performance.
SKILL.md
rendered from the published skill — quoted content, verbatim
Cloudflare Workers Observability
Production-grade observability for Cloudflare Workers: logging, metrics, tracing, and alerting.
Quick Start
```typescript // Structured logging with context export default { async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { const requestId = crypto.randomUUID(); const logger = createLogger(requestId, env);
try {
logger.info('Request received', { method: request.method, url: request.url });
const result = await handleRequest(request, env);
logger.info('Request completed', { status: result.status });
return result;
} catch (error) {
logger.error('Request failed', { error: error.message, stack: error.stack });
throw error;
}
} };
// Simple logger factory function createLogger(requestId: string, env: Env) { return { info: (msg: string, data?: object) =>
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 11 files
plugins/cloudflare-workers/skills/cloudflare-workers-observability/SKILL.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/references/alerting.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/references/analytics-engine.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/references/custom-metrics.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/references/logging.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/references/tail-workers.md
plugins/cloudflare-workers/skills/cloudflare-workers-observability/scripts/analyze-logs.sh
plugins/cloudflare-workers/skills/cloudflare-workers-observability/scripts/setup-logging.sh
plugins/cloudflare-workers/skills/cloudflare-workers-observability/templates/analytics-worker.ts
plugins/cloudflare-workers/skills/cloudflare-workers-observability/templates/logging-setup.ts
plugins/cloudflare-workers/skills/cloudflare-workers-observability/templates/tail-worker.ts