Skip to content

Cursor integration with Coralogix

Connect Cursor agent sessions to Coralogix and stream traces from local installations. Once connected, each Cursor agent session appears as a trace in Coralogix with spans for prompts, tool usage, file edits, and session activity.

What you need

  • A Coralogix account with a Send-Your-Data API key. In Coralogix, navigate to Settings, then API Keys.
  • Your Coralogix OTLP endpoint: ingress.:443. Use the domain selector at the top of this page to select your region.
  • Cursor installed on your machine.

Set up

Install

Clone the Coralogix AI agent instrumentation repository and navigate to the Cursor directory:

git clone https://github.com/coralogix/ai-agent-instrumentation.git
cd ai-agent-instrumentation/cursor

Configure

  1. Copy the example environment file:

    cp .env.example .env
    
  2. Open .env and set the following values:

    • CX_API_KEY — your Send-Your-Data API key
    • CX_OTLP_ENDPOINT — your OTLP endpoint (ingress.:443)
  3. Install the Cursor hook:

    ./install.sh --env-file .env
    
  4. Restart Cursor.

    Cursor agent sessions now stream traces to Coralogix.

View data in Coralogix

Open the Code agents dashboard in Coralogix to monitor token usage, costs, tool calls, code changes, and session activity from your Cursor agent sessions.

For individual session details, open Distributed Tracing and filter by your application and subsystem names. Each Cursor agent session appears as a single trace with all spans grouped by conversation_id.

Data available

SignalWhere in Coralogix
Sessions and unique usersTracing (cursor.conversation_id, cursor.user_email)
Prompt token usage over timeTracing (cursor.beforeSubmitPromptcursor.prompt_len)
Lines added and removedTracing (cursor.afterFileEditcursor.lines_added, cursor.lines_deleted)
Session durationTracing (cursor.stopcursor.session_duration_ms)
Model distributionTracing (gen_ai.request.model)
Top tools usedTracing (gen_ai.tool.name)

Privacy options

Add these values to your .env before running the installation script:

# Replace all prompt and response text with [MASKED]
CURSOR_MASK_PROMPTS=true

# Skip preToolUse spans to reduce trace noise
CURSOR_OMIT_PRE_TOOL_USE_SPANS=true

Complete configuration

For the full configuration reference, see cursor in the GitHub repository.

Troubleshoot

No traces appear

In Cursor, select View, then Output, then Hooks, and look for export errors. Set CX_OTLP_DEBUG=true in .env, and run ./install.sh --env-file .env again for verbose output.

Hooks do not fire

Confirm that agent hooks are active in Cursor Settings, then Features, then Agent.

Next steps

After you set up the integration, explore Code agents to monitor token usage, costs, tool calls, code changes, and session data across all your coding agents.