Code & Dev Compatible: claude

OpenTelemetry Tracing for a Critical Route

Complexity Level: Beginner
Prompt Code Block

Add useful traces to one critical path. The goal is a trace a human can read during an incident, not a span on every function. APP Runtime: [NODE ON NEXT.JS | NODE ON A SERVER | PYTHON] Route or job: [NAME AND WHAT IT DOES] Downstream calls: [DB, HTTP APIS, QUEUE, CACHE] Collector: [HONEYCOMB | GRAFANA TEMPO | DATADOG | OTLP GENERIC] Symptoms we are trying to explain: [SLOW | ERROR SPIKES | OCCASIONAL TIMEOUTS] Cardinality traps in our domain: [USER IDS, EMAILS, RAW SQL] DELIVER 1) SDK setup: which packages, where to init so it runs before other imports, and the resource attributes (service.name, deployment.environment). 2) The span tree for this route only. Name each span as verb + object ("load subscription", "charge invoice"). Mark which are children vs links. 3) Attributes worth attaching, and a denylist (emails, tokens, raw SQL text, full request bodies). Use ids, status codes, cache hit, and row counts. 4) How errors land on the span (recordException, status code) without double-reporting to the error tracker. 5) Sampling: a rule that keeps errors and slow traces and samples the healthy majority, with numbers I can edit. 6) A worked example of one trace timeline in text (span, duration, attribute) for the slow case I described. 7) The one dashboard query: p95 of this route and error rate, grouped by a low-cardinality attribute. Do not wrap every internal helper in a span. If a span would always be under 1ms and has no attributes, leave it out and say so.

🌟 Example Output / Preview

### Generated Component Preview: ```typescript // Fully validated modern structure import { z } from 'zod'; export const RequestSchema = z.object({ id: z.string().uuid(), createdAt: z.date().default(() => new Date()), data: z.record(z.string(), z.any()) }); export type ValidatedRequest = z.infer<typeof RequestSchema>; ```

Prompt Metadata

DifficultyBeginner
Compatibilityclaude

Primary Use Cases:

  • •Legacy code modernization & technical refactoring
  • •Full-stack layout generation & component structuring
  • •CI/CD workflow automation & unit/E2E testing suites

Associated Tags:

#opentelemetry #observability #api #nextjs

💡 Pro Tips & Advice

1. Use bracketed items: Be sure to fill out all [PLACEHOLDER] elements with specific details before sending the prompt to the AI model.

2. Adjust temperature: For creative tasks, set AI temperature higher (e.g., 0.8), or lower (e.g., 0.2) for strict coding/technical tasks.

🔗 Related AI Prompts

Code & Dev
★ Featured

Full SaaS Landing Page Build Spec (SEO + Conversion)

You are a Staff Product Designer + Frontend Engineer + SEO strategist. Build a complete, production-ready marketing landing page f...

Compatible:claudeDiff:Advanced
#landing-page #saas #seo #nextjs #tailwind
Code & Dev
★ Featured 🔥 Trending

SaaS Analytics Dashboard Full Build Spec

You are a Principal Product Designer + Frontend Lead. Design and specify a complete [LIGHT | DARK] analytics dashboard for [PRODUC...

Compatible:claudeDiff:Intermediate
#dashboard #saas #ui #tailwind #seo
Code & Dev

SaaS Admin Panel Dashboard Build Spec

Design a full internal Admin Dashboard for [PRODUCT_NAME] used by [ADMIN_ROLE: support | ops | super-admin]. --- 🎯 CONTEXT Adm...

Compatible:claudeDiff:Intermediate
#admin #dashboard #saas #crud #tailwind