Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fintegrations%2Fai-observability%2Fcursor.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fintegrations%2Fai-observability%2Fcursor.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# 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[​](#what-you-need "Direct link to What you need")

* A Coralogix account with a **Send-Your-Data [API key](https://docs-docusaurus.kinsta.page/user-guides/account-management/api-keys/send-your-data-api-key/.md)**. In Coralogix, navigate to **Settings**, then **API Keys**.
* Your Coralogix OTLP endpoint: `https://ingress.eu2.coralogix.com:443`. Use the domain selector at the top of this page to select your region.
* Cursor installed on your machine.

## Set up[​](#set-up "Direct link to Set up")

### Install[​](#install "Direct link to 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[​](#configure "Direct link to 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, including the `https://` prefix (for example, `https://ingress.eu2.coralogix.com: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[​](#view-data-in-coralogix "Direct link to View data in Coralogix")

Open the [Code agents](https://docs-docusaurus.kinsta.page/user-guides/ai/code-agents/.md) 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](https://docs-docusaurus.kinsta.page/user-guides/data_exploration/spans/explore-spans/.md) in Coralogix 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[​](#data-available "Direct link to Data available")

| Signal                       | Where in Coralogix                                                            |
| ---------------------------- | ----------------------------------------------------------------------------- |
| Sessions and unique users    | Tracing (`cursor.conversation_id`, `cursor.user_email`)                       |
| Prompt token usage over time | Tracing (`cursor.beforeSubmitPrompt`—`cursor.prompt_len`)                     |
| Lines added and removed      | Tracing (`cursor.afterFileEdit`—`cursor.lines_added`, `cursor.lines_deleted`) |
| Session duration             | Tracing (`cursor.stop`—`cursor.session_duration_ms`)                          |
| Model distribution           | Tracing (`gen_ai.request.model`)                                              |
| Top tools used               | Tracing (`gen_ai.tool.name`)                                                  |

## Data scopes[​](#data-scopes "Direct link to Data scopes")

Cursor emits spans. Use [data scopes](https://docs-docusaurus.kinsta.page/user-guides/account-management/user-management/scopes/.md) to restrict which Cursor data each user can see. See [Code agents observability — Data scopes](https://docs-docusaurus.kinsta.page/user-guides/ai/code-agents/.md#data-scopes) for the per-agent breakdown.

## Privacy options[​](#privacy-options "Direct link to 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[​](#complete-configuration "Direct link to Complete configuration")

For the full configuration reference, see [cursor in the GitHub repository](https://github.com/coralogix/ai-agent-instrumentation/tree/master/cursor).

## Troubleshoot[​](#troubleshoot "Direct link to Troubleshoot")

### No traces appear[​](#no-traces-appear "Direct link to 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[​](#hooks-do-not-fire "Direct link to Hooks do not fire")

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

## Next steps[​](#next-steps "Direct link to Next steps")

After you set up the integration, explore [Code agents](https://docs-docusaurus.kinsta.page/user-guides/ai/code-agents/.md) to monitor token usage, costs, tool calls, code changes, and session data across all your coding agents.
