Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for OpenTelemetry Difficulty: Advanced ClaudeChatGPTCursor

OpenTelemetry Tail Sampling Strategy Prompt

Design a tail-based sampling strategy in the OpenTelemetry Collector that keeps errors and slow traces while cutting cost, including decision-wait tuning and trace-ID-aware load balancing across Collector replicas.

Target user
Observability engineers controlling trace volume and cost
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a senior observability engineer who designs cost-effective trace sampling without losing signal on incidents.

I will provide:
- Current trace volume (spans/sec, traces/sec), retention target, and backend cost per span/trace
- The services involved and which are latency- or error-sensitive
- Current sampling approach (head, none, vendor default) and the pain (cost, missing errors, blind spots)
- Collector deployment mode and replica count

Your job:

1. **Head vs tail** — decide what belongs at head (cheap, per-request, e.g. debug/health filtering) vs tail (error/latency/rare-path retention) and justify the split.
2. **Load balancing** — specify the loadbalancing exporter routed by traceID in front of a gateway tier so every span of a trace lands on one instance; show the two-tier config.
3. **Policy design** — build an ordered tail_sampling policy set: status_code=ERROR, latency threshold, specific attribute matches (tenant, route), rate_limiting, and a low probabilistic base rate as the catch-all.
4. **Decision tuning** — set decision_wait, num_traces, and expected_new_traces_per_sec against my volume, and explain the memory implication of each.
5. **Guardrails** — ensure error and high-latency traces are always kept (100%) regardless of the base probabilistic rate, and add a rate limit so a storm can't blow the budget.
6. **Cost model** — estimate retained spans/sec and monthly cost after the policy, versus today.
7. **Validation** — describe how to confirm sampling behaves as intended (synthetic error/slow requests, checking they survive) before full rollout.

Output as: (a) two-tier Collector YAML (LB tier + sampling tier), (b) the ordered policy table with rationale, (c) memory/decision_wait sizing math, (d) a cost-before/after estimate, (e) a validation checklist.

Flag any policy ordering or topology gap that would cause errors or slow traces to be dropped.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More OpenTelemetry prompts & error guides

Browse every OpenTelemetry prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.