OpenTelemetry Baggage and Span Links Design Prompt
Design correct use of OpenTelemetry Baggage and span links: propagate business context (tenant, request class) across services, and link asynchronous or batched work back to originating traces without abusing baggage as a data bus.
- Target user
- Engineers modeling complex async, fan-out, and multi-tenant trace topologies
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior observability engineer who models context flow across services, queues, and batch jobs. I will provide: - The request topology (sync calls, message queues, batch/fan-out, cron) - The business context that must follow a request (tenant, plan, request class, feature flag) - Languages/SDKs and current propagator configuration - What is hard to trace today (async gaps, batched work, one-to-many links) Your job: 1. **Baggage vs attributes** — decide what belongs in Baggage (must cross service boundaries and influence downstream behavior) versus what should be a local span attribute only. Justify each key. 2. **Baggage design** — define the exact baggage keys, allowed value sets, size budget, and which propagator carries them; show how to set and read baggage in my SDKs. 3. **Attribute promotion** — specify which baggage keys are copied onto spans (via a processor or explicit code) for querying, and the cardinality impact of each. 4. **Span links** — model the async/fan-out cases: producer stores context on the message, consumer creates a new root span with a link back to the producing span; show the code for enqueue and dequeue. 5. **Batch/one-to-many** — for a batch that processes many messages, design links so the batch span references all contributing traces without creating one giant trace. 6. **Security review** — confirm no secret/PII/oversized value is in baggage and that header size stays within gateway limits. 7. **Validation** — describe how to verify baggage arrives downstream and that links render correctly in the backend. Output as: (a) a baggage key table (key, values, size, propagator), (b) set/read code for my SDKs, (c) span-link code for producer and consumer, (d) the batch linking pattern, (e) a security and validation checklist. Flag any baggage key that risks leaking sensitive data or blowing header size limits.
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
-
OpenTelemetry Context Propagation Strategy Prompt
Fix broken distributed traces by designing correct context propagation across HTTP, gRPC, messaging queues, and async boundaries, standardizing on W3C tracecontext/baggage and handling gateways that strip headers.
-
OpenTelemetry Log Correlation and Trace Linking Prompt
Wire application logs into the OpenTelemetry logs signal and correlate them with traces by injecting trace_id and span_id, so a single click moves between a slow trace and its exact log lines across services.
-
OpenTelemetry Collector Gateway Scaling & HA Prompt
Design a horizontally scalable, highly available OpenTelemetry Collector gateway tier — autoscaling, load balancing, queue persistence, and zero-loss rolling upgrades — so telemetry survives replica churn and traffic spikes.
-
OpenTelemetry Collector Routing & Multi-Backend Fan-out Prompt
Design a routing-connector-based OpenTelemetry Collector topology that fans telemetry out to multiple backends or tenants by attribute — with per-route processors, failover, and cost tiers — without duplicating data or dropping unmatched signals.
More OpenTelemetry prompts & error guides
Browse every OpenTelemetry prompt and troubleshooting guide in one place.
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.