Back to cookbook

AI Prompt to Triage Production Incidents Using Datadog's MCP Server

2 views Published

Make this prompt yours

Share

This AI prompt is built for on-call engineers who need to triage a production incident fast, using Datadog's MCP server to pull live metrics, logs, and monitor alerts straight into the conversation instead of switching between dashboards mid-incident. Once Datadog is connected over MCP, the assistant can read the firing monitors, recent error spikes, and affected services, then help you work out what actually broke and where to look next.

The prompt asks the model to correlate the triggered alerts with recent deploys or infrastructure changes, rank the likely root causes by how well they fit the observed symptoms, and lay out the next diagnostic steps instead of jumping straight to a guess. It is meant to compress the first ten minutes of an incident, when most of the time is spent just figuring out where to look, not to replace a proper post-incident review.

Because on-call situations move fast and the output needs to be scannable under pressure, keeping the prompt's structure tight matters more than in most other use cases. If you want to tighten or shorten this template for your own alerting setup before you rely on it live, the Prompt Optimizer can help restructure it in its Coding mode.

Prompt template

Make this prompt yours

prompt-template
266 tokens
ROLE: You are an on-call engineering assistant helping triage a live production incident. CONTEXT: - Service(s) affected: [SERVICE NAMES] - Triggered monitor(s): [MONITOR NAME(S) AND ALERT MESSAGE(S)] - Time incident started: [TIMESTAMP] - Relevant metrics/logs: [PASTE RECENT ERROR RATES, LATENCY, OR LOG EXCERPTS FROM DATADOG] - Recent changes: [LIST DEPLOYS, CONFIG CHANGES, OR INFRA CHANGES IN THE LAST 24 HOURS WITH TIMESTAMPS] TASK: 1. Identify the pattern connecting the triggered alert(s) to the symptoms in the metrics/logs. 2. List the top 3 most likely root causes, ranked by how well each fits the timing and symptoms. 3. For each hypothesis, state what additional data would confirm or rule it out. 4. Recommend the single next diagnostic step to run first. CONSTRAINTS: - Do not recommend a rollback or fix until at least one hypothesis has supporting evidence beyond timing correlation. - Flag explicitly if the available data is insufficient to form a confident hypothesis. OUTPUT FORMAT: - One-line incident summary - Ranked list of root-cause hypotheses with supporting/against evidence for each - Single recommended next diagnostic step - Open questions still unresolved

Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.

Example input

example-input
130 tokens
Service affected: checkout-api Triggered monitor: "checkout-api 5xx rate > 5%" fired at 14:32 UTC Time incident started: 14:32 UTC Relevant metrics/logs: 5xx rate jumped from 0.2% to 9% at 14:30. Logs show repeated "connection pool exhausted" errors from the payments-db client starting at 14:29. Recent changes: Deploy of checkout-api v2.14.0 at 14:15 UTC increased default DB connection pool timeout from 5s to 15s. No other deploys in the last 24 hours.

When to use it

  • The moment a Datadog monitor fires and you need a fast first read on likely cause
  • Correlating an error spike with a recent deploy, config change, or traffic shift
  • Handing off an in-progress incident to another engineer with a clear summary
  • Writing the first draft of an incident timeline while details are still fresh

Best practices

  • Pull in the specific monitors and services that fired, not your whole Datadog account, to keep the context focused
  • Always include the timestamp of the most recent deploy or config change alongside the alert data
  • Ask the model to rank root-cause hypotheses by confidence instead of stating just one, since early signals are often incomplete
  • Treat the output as a triage starting point and confirm any proposed fix against the actual logs before acting on it

Common mistakes

  • Pasting in raw, unfiltered log dumps instead of the specific error patterns tied to the alert
  • Skipping the deploy history, which is often the single strongest signal for root cause
  • Asking only "what's wrong" without specifying which service or endpoint the incident affects
  • Treating a plausible-sounding root cause as confirmed without checking it against the actual metrics

FAQs

How does Datadog's MCP server work with ChatGPT or Claude?

Datadog's MCP server exposes your monitors, metrics, and logs as tools the model can call directly, so instead of copy-pasting dashboard screenshots, the assistant can query live data during the conversation and reason over it in real time.

Can this prompt replace a real incident postmortem?

No. It's designed to speed up the first few minutes of triage, when you're still figuring out what broke; a proper postmortem needs a fuller timeline, contributing factors, and action items gathered after the incident is resolved.

What if I don't have deploy history connected to Datadog?

You can still run the prompt with just metrics and logs, but root-cause confidence will be lower without change correlation; consider pulling deploy timestamps from your CI/CD tool manually and pasting them into the context section.

Does this work for non-Datadog observability tools like New Relic or Grafana?

The prompt structure works with any observability data you can paste in, but you'd need that platform's own MCP server (or manual exports) instead of Datadog's to get live data pulled automatically.

What tool pairs well with this prompt for on-call use?

Prompt Optimizer — its Coding mode is built for exactly this kind of technical, structure-heavy prompt, and can help you trim it down for faster reading under incident pressure.

Found this prompt useful? Share it.

Share

More in Engineering

Engineering

AI Prompt to Write a Load Testing Plan for a REST API Endpoint

This prompt has ChatGPT, Claude, or Gemini draft a concrete load testing plan for a REST API endpoint before you run a single test. It's for…

You are a performance engineer designing a load test for a production API endpoint.

Context:
- Endpoint: [METHOD AND PATH, e.g. POST /api/v1/orders]
- Expected traffic: [REQUESTS PER SECOND AT PEAK, e.g. 150 rps average, 600 rps peak]
- Downstream dependencies: [LIST, e.g. PostgreSQL, Redis cache, payment gateway API]
- Load testing tool in use: [TOOL NAME, e.g. k6, Locust, JMeter]
- Current known constraints: [e.g. database connection pool size, rate limiter config]

Write a load testing plan with the following requirements:
1. Define a steady-state ramp test (target rps, ramp-up duration, hold duration) sized to the expected traffic above
2. Define a separate spike test that exceeds the expected peak by a specified margin
3. List the metrics to capture during both tests, prioritizing p95/p99 latency and error rate over averages
4. Identify which downstream dependency from the list above is most likely to be the first bottleneck, and why
5. Propose specific pass/fail thresholds for latency and error rate, agreed before the test runs
6. Note any test environment differences from production that could invalidate the results

Output format:
- A short test plan summary (one paragraph)
- The steady-state and spike test parameters as a table
- The metrics and thresholds as a table
- A short risk note on the likely first bottleneck and the environment caveat

Make this prompt yours

Engineering

AI Prompt to Write a Feature Flag Rollout and Cleanup Plan

A feature flag rollout plan lays out how a new capability ships behind a flag, moves through stages of exposure, and eventually gets removed…

You are a senior platform engineer helping plan a feature flag rollout.

Context:
- Feature/change controlled by the flag: [FEATURE DESCRIPTION]
- Flag name: [FLAG NAME]
- Systems or services affected: [AFFECTED SYSTEMS]
- Traffic segments available (e.g. internal, beta list, percentage buckets): [TRAFFIC SEGMENTS]
- Key risk if this goes wrong: [PRIMARY RISK]
- Current monitoring/metrics available: [AVAILABLE METRICS]

Task:
1. Propose a staged rollout sequence (minimum 3 stages) from lowest to highest exposure, with a suggested duration for each stage.
2. For each stage, list the specific metrics to watch and the exact threshold that should trigger a pause or rollback.
3. Define who should approve advancing to the next stage.
4. Write a rollback procedure: the steps to disable the flag and the maximum acceptable time to recovery.
5. Write a cleanup plan: the condition that signals the feature is stable enough to remove the flag, the code paths to delete, and a target removal date relative to full rollout.

Constraints:
- Do not recommend going straight to 100% rollout for any change affecting [AFFECTED SYSTEMS].
- Keep each stage's exit criteria measurable, not subjective.
- Flag any step that depends on information not provided above.

Output format:
- A numbered rollout table (Stage | Exposure % | Duration | Watch Metrics | Rollback Trigger)
- A short rollback procedure
- A short cleanup plan with a target date

Make this prompt yours

Engineering

AI Prompt to Diagnose and Fix Slow Database Queries

This AI prompt helps you diagnose and fix slow database queries by walking through the execution plan, indexing, and query structure instead…

You are a senior database engineer specializing in query performance tuning.

Context:
- Database engine and version: [e.g., PostgreSQL 15, MySQL 8]
- The slow query: [PASTE THE SQL QUERY]
- Execution plan output: [PASTE EXPLAIN / EXPLAIN ANALYZE OUTPUT]
- Relevant table schemas, including existing indexes: [PASTE SCHEMA]
- Approximate row counts for each table involved: [ROW COUNTS]
- How slow it currently runs vs. your target: [CURRENT TIME] vs [TARGET TIME]

Instructions:
1. Identify the most likely cause(s) of the slowness from the execution plan, ranked by probable impact.
2. For each cause, explain in plain language what's happening (for example, "full table scan because no index covers this WHERE clause").
3. Propose the smallest change that would fix the top cause first, before any structural changes.
4. Provide the rewritten query or the exact index definition (CREATE INDEX statement) to test.
5. Note any trade-off the fix introduces, such as added write overhead from a new index.

Constraints:
- Do not suggest denormalizing the schema unless indexing and query rewrites are insufficient.
- Keep the explanation grounded in the specific execution plan provided, not generic query-optimization advice.

Output format:
Return the answer as: Likely Causes (ranked), Recommended Fix, SQL/Index to Test, Trade-offs.

Make this prompt yours