$npx -y skills add getsentry/sentry-for-ai --skill sentry-otel-exporter-setupConfigure the OpenTelemetry Collector with Sentry Exporter for multi-project routing and automatic project creation. Use when setting up OTel with Sentry, configuring collector pipelines for traces and logs, or routing telemetry from multiple services to Sentry projects.
| 1 | > [All Skills](../../SKILL_TREE.md) > [Feature Setup](../sentry-feature-setup/SKILL.md) > OTel Exporter |
| 2 | |
| 3 | # Sentry OTel Exporter Setup |
| 4 | |
| 5 | **Terminology**: Always capitalize "Sentry Exporter" when referring to the exporter component. |
| 6 | |
| 7 | Configure the OpenTelemetry Collector to send traces and logs to Sentry using the Sentry Exporter. |
| 8 | |
| 9 | ## Setup Overview |
| 10 | |
| 11 | Copy this checklist to track your progress: |
| 12 | |
| 13 | ``` |
| 14 | OTel Exporter Setup: |
| 15 | - [ ] Step 1: Check for existing configuration |
| 16 | - [ ] Step 2: Check collector version and install if needed |
| 17 | - [ ] Step 3: Configure project creation settings |
| 18 | - [ ] Step 4: Write collector config |
| 19 | - [ ] Step 5: Add environment variable placeholders |
| 20 | - [ ] Step 6: Run the collector |
| 21 | - [ ] Step 7: Verify setup |
| 22 | - [ ] Step 8: Enable trace connectedness with OTLPIntegration (Python/Ruby/Node.js) |
| 23 | ``` |
| 24 | |
| 25 | ## Step 1: Check for Existing Configuration |
| 26 | |
| 27 | Search for existing OpenTelemetry Collector configs by looking for YAML files containing `receivers:`. Also check for files named `otel-collector-config.*`, `collector-config.*`, or `otelcol.*`. |
| 28 | |
| 29 | **If an existing config is found**: Ask the user which approach they want: |
| 30 | - **Modify existing config**: Add Sentry Exporter to the existing file (recommended to avoid duplicates) |
| 31 | - **Create separate config**: Keep existing config unchanged and create a new one for testing |
| 32 | |
| 33 | **Wait for the user's answer and record their choice before proceeding to Step 2.** The rest of the workflow depends on this decision. |
| 34 | |
| 35 | **If no config exists**: Note that you'll create a new `collector-config.yaml` in Step 4, then proceed to Step 2. |
| 36 | |
| 37 | ## Step 2: Check Collector Version |
| 38 | |
| 39 | The Sentry Exporter requires **otelcol-contrib v0.145.0 or later**. |
| 40 | |
| 41 | ### Check for existing collector |
| 42 | |
| 43 | 1. Run `which otelcol-contrib` to check if it's on PATH, or check for `./otelcol-contrib` in the project |
| 44 | 2. If found, run the appropriate version command and parse the version number |
| 45 | 3. **Record the collector path** (e.g., `otelcol-contrib` if on PATH, or `./otelcol-contrib` if local) for use in later steps |
| 46 | |
| 47 | | Existing Version | Action | |
| 48 | |------------------|--------| |
| 49 | | ≥ 0.145.0 | Skip to Step 3 — existing collector is compatible | |
| 50 | | < 0.145.0 | Proceed with installation below | |
| 51 | | Not installed | Proceed with installation below | |
| 52 | |
| 53 | ### Installation |
| 54 | |
| 55 | Ask the user how they want to run the collector: |
| 56 | - **Binary**: Download from GitHub releases. No Docker required. |
| 57 | - **Docker**: Run as a container. Requires Docker installed. |
| 58 | |
| 59 | ### Binary Installation |
| 60 | |
| 61 | Fetch the latest release version from GitHub: |
| 62 | ```bash |
| 63 | curl -s https://api.github.com/repos/open-telemetry/opentelemetry-collector-releases/releases/latest | grep '"tag_name"' | cut -d'"' -f4 |
| 64 | ``` |
| 65 | |
| 66 | **Important**: The GitHub API returns versions with a `v` prefix (e.g., `v0.145.0`). The download URL path requires the full tag with `v` prefix, but the filename and Docker tags use the numeric version without the prefix (e.g., `0.145.0`). |
| 67 | |
| 68 | Detect the user's platform and download the binary: |
| 69 | |
| 70 | 1. Run `uname -s` and `uname -m` to detect OS and architecture |
| 71 | 2. Map to release values: |
| 72 | - Darwin + arm64 → `darwin_arm64` |
| 73 | - Darwin + x86_64 → `darwin_amd64` |
| 74 | - Linux + x86_64 → `linux_amd64` |
| 75 | - Linux + aarch64 → `linux_arm64` |
| 76 | 3. Download and extract: |
| 77 | ```bash |
| 78 | curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v<numeric_version>/otelcol-contrib_<numeric_version>_<os>_<arch>.tar.gz |
| 79 | tar -xzf otelcol-contrib_<numeric_version>_<os>_<arch>.tar.gz |
| 80 | chmod +x otelcol-contrib |
| 81 | ``` |
| 82 | |
| 83 | Example: For version `v0.145.0`, the URL uses `v0.145.0` in the path but `0.145.0` in the filename. |
| 84 | |
| 85 | Perform these steps for the user—do not just show them the commands. |
| 86 | |
| 87 | 4. **Ask the user** if they want to delete the downloaded tarball to save disk space (~50MB): |
| 88 | - **Yes, delete it**: Remove the tarball |
| 89 | - **No, keep it**: Leave the tarball in place |
| 90 | |
| 91 | **Wait for the user's response.** Only delete if they explicitly choose to: |
| 92 | ```bash |
| 93 | rm otelcol-contrib_<numeric_version>_<os>_<arch>.tar.gz |
| 94 | ``` |
| 95 | |
| 96 | ### Docker Installation |
| 97 | |
| 98 | 1. Verify Docker is installed by running `docker --version` |
| 99 | 2. Fetch the latest release tag from GitHub (same as above) |
| 100 | 3. Pull the image using the numeric version (without `v` prefix): |
| 101 | ```bash |
| 102 | docker pull otel/opentelemetry-collector-contrib:<numeric_version> |
| 103 | ``` |
| 104 | |
| 105 | Example: For GitHub tag `v0.145.0`, use `docker pull otel/opentelemetry-collector-contrib:0.145.0`. |
| 106 | |
| 107 | The `docker run` command comes later in Step 6 after the config is created. |
| 108 | |
| 109 | ## Step 3: Configure Sentry Project Creation |
| 110 | |
| 111 | Ask the user whether to enable automatic Sentry project |