D
+
C

From Incident to Fix

I designed this co-sell motion to show how Cursor supercharges Datadog's monitoring stack with agentic automation, turning alerts into automated fixes without leaving the IDE.

Cursor helps enterprises maximize ROI from their existing solutions. This motion is repeatable across any Datadog customer.

Scroll to experience the workflow

Act 1

Alert Fires

Datadog detects an anomaly in production. P99 latency on the checkout endpoint has spiked well beyond the configured threshold.

D
Datadog APM
Last 1h prod-us-west

ALERT: P99 Latency Spike Detected

/api/checkout • P99: 2,340ms (threshold: 500ms) • Triggered 3m ago

Endpoint Latency (P99)2,340ms
-60mnow

Error Rate

4.7%

+380% from baseline

Throughput

1,240 req/s

Within normal range

Affected Users

~2,100

In last 3 minutes

Act 2

Engineer Opens Cursor

The on-call engineer opens the checkout handler in Cursor with full codebase context. The relevant file is immediately accessible.

handler.ts
Cursor
1import { validateCart } from './validation';
2import { calculatePricing } from './pricing';
3import { PaymentGateway } from '@/services/payment';
4import { InventoryService } from '@/services/inventory';
5
6export async function handleCheckout(req: Request) {
7 const cart = await req.json();
8 const validated = await validateCart(cart);
9
10 // BUG: Sequential await causes latency spike under load
11 const pricing = await calculatePricing(validated);
12 const inventory = await InventoryService.check(validated.items);
13 const payment = await PaymentGateway.preauth(pricing);
14
15 if (!inventory.available) {
16 return Response.json({ error: 'Out of stock' }, { status: 409 });
17 }
18
19 const result = await PaymentGateway.capture(payment.id);
20 await InventoryService.reserve(validated.items);
21
22 return Response.json({ orderId: result.orderId });
23}
Act 3

Cursor Analyzes the Codebase

Cursor scans the entire codebase, traces related code paths, and identifies the root cause of the latency spike in seconds.

Scanning codebase

47 files analyzed

Tracing code paths

3 related paths found

Identifying root cause

Sequential await pattern

Generating fix

Promise.all() parallelization

Cursor AI Analysis
Act 4

Fix Generated

Cursor generates a targeted fix that parallelizes the independent operations while preserving the dependency chain.

Before

handler.ts (lines 11-13)
- // Sequential: each await blocks the next
- const pricing = await calculatePricing(validated);
- const inventory = await InventoryService.check(validated.items);
- const payment = await PaymentGateway.preauth(pricing);

After

handler.ts (lines 11-18)
+ // Parallel: all independent operations run concurrently
+ const [pricing, inventory] = await Promise.all([
+ calculatePricing(validated),
+ InventoryService.check(validated.items),
+ ]);
+
+ // Payment depends on pricing, so it runs after
+ const payment = await PaymentGateway.preauth(pricing);

Cursor's Explanation

The original code awaited three operations sequentially: pricing calculation, inventory check, and payment pre-authorization. However, pricing and inventory are independent of each other, so they can run concurrently using Promise.all(). Payment pre-auth depends on the pricing result, so it must still run after. This change eliminates one full round-trip of latency under load.

4 min

Time to generate fix

~65%

Latency reduction

2.3 hrs

Average manual debug time saved

Act 5

Better Together

D
C

Detect Faster

Datadog surfaces the anomaly the moment it starts. No waiting for user reports or manual log analysis.

Fix Faster

Cursor analyzes the full codebase context and generates targeted fixes in minutes, not hours.

Prevent Recurrence

Cursor can generate tests for the fix and identify similar patterns elsewhere in the codebase before they cause incidents.

0%

Reduction in Mean Time to Resolution

When detection and intelligent code analysis work together, incident resolution transforms from hours to minutes.