/cursor-tutorials

How to add tracing and observability with Cursor

Learn how to add tracing and observability in Cursor to boost debugging, performance insights, and developer productivity.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to add tracing and observability with Cursor

You add tracing and observability with Cursor the same way you do in a normal local project: you install a real tracing/telemetry library (like OpenTelemetry), instrument your code, and then use Cursor to help search/modify code across files, generate boilerplate, and refactor safely. Cursor itself does not provide tracing. It just helps you integrate tracing into your actual application codebase and makes the editing process much faster.

 

What “adding tracing with Cursor” really means

 

You’re not adding tracing to Cursor. You’re adding tracing to your codebase while using Cursor as an accelerated editor. Cursor’s job here is:

  • Helping you scaffold OpenTelemetry setup files across Node/Python/React/etc.
  • Finding all your API handlers or backend functions to insert spans.
  • Explaining where tracing hooks should go.
  • Keeping the edits consistent across many files.
  • Letting you run and test the tracing locally through the integrated terminal.

So the workflow is: choose a real observability provider → add instrumentation → verify locally in Cursor’s terminal → push to Git and deploy.

 

How to add tracing using OpenTelemetry (Node example)

 

This is the most common setup: OpenTelemetry for tracing + a backend like Jaeger, Zipkin, or an APM provider (Datadog, Honeycomb, New Relic). Everything below is 100% real and will work locally inside Cursor.

 

// Install OpenTelemetry packages
npm install @opentelemetry/api @opentelemetry/sdk-node \
  @opentelemetry/auto-instrumentations-node \
  @opentelemetry/exporter-trace-otlp-http

 

Create a file called tracing.js and run it before your server starts.

 

// tracing.js
const { NodeSDK } = require('@opentelemetry/sdk-node')
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http')
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')

// Create an exporter that sends traces to a local collector
const traceExporter = new OTLPTraceExporter({
  url: 'http://localhost:4318/v1/traces' // Real OTLP endpoint
})

const sdk = new NodeSDK({
  traceExporter,
  instrumentations: [getNodeAutoInstrumentations()] // Auto-hooks for HTTP, Express, etc.
})

sdk.start()
  .then(() => console.log('Tracing initialized'))
  .catch(err => console.error('Error starting tracing', err))

 

Modify your server entry file (usually something like server.js or index.js) so tracing loads before anything else.

 

// server.js

require('./tracing') // IMPORTANT: must load before express or any instrumentation

const express = require('express')
const app = express()

app.get('/hello', (req, res) => {
  res.json({ ok: true })
})

app.listen(3000, () => console.log('Server running'))

 

How Cursor helps during this setup

 

  • You can ask Cursor to “find every route handler and wrap it in a manual span” and it will open/edit all files at once.
  • If your project is large, Cursor can map out where requests enter and help choose the right places for instrumentation.
  • Cursor can auto-generate boilerplate for Python, Node, or even frontend RUM instrumentation.
  • Cursor can explain the tracing flow if you’re new to OpenTelemetry.
  • Because Cursor understands multiple files, it helps you avoid inconsistent instrumentation across services.

 

Manual span example (useful in business logic)

 

const { trace } = require('@opentelemetry/api')

function calculatePrice(userId) {
  const tracer = trace.getTracer('app')
  const span = tracer.startSpan('calculatePrice') // span name visible in Jaeger/Datadog/etc.

  try {
    // your logic...
    return 42
  } finally {
    span.end() // REQUIRED
  }
}

 

Running and viewing traces locally in Cursor

 

You’ll need a real trace collector. The easiest is the official OpenTelemetry Collector.

 

// Run collector locally with Docker (standard OTLP port exposed)
docker run -p 4318:4318 \
  otel/opentelemetry-collector:latest

 

Now start your app through Cursor’s terminal. When you hit routes (via browser or curl), traces will appear in the collector pipeline, which you can later forward to:

  • Jaeger
  • Zipkin
  • Honeycomb
  • Datadog (with OTLP enabled)
  • New Relic

 

How to use Cursor effectively for observability work

 

  • Ask the editor: “Add OpenTelemetry initialization for Node and wire it into my server file.”
  • Use multi-file diff view to confirm every change is correct—Cursor is powerful but not perfect.
  • Ask: “Show me every place where requests start in this backend” to identify trace entry points.
  • Use “edit this file” mode for small targeted instrumentation.
  • Use “composer” for scaffolding collector configs (YAML files, exporters, etc.).

 

The key idea: Cursor does not run or collect telemetry. It simply makes the setup, code changes, and navigation dramatically faster and safer. The tracing itself always comes from real libraries like OpenTelemetry.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022