Skip to main content
OpenSRE queries Sentry to retrieve recent issues, error events, and stack traces — correlating application errors with infrastructure alerts to identify root causes faster.

Prerequisites

  • Sentry account with at least one organization
  • Auth token with event:read scope

Setup

Option 1: Interactive CLI

opensre integrations setup
Select Sentry when prompted and provide your organization slug and auth token.

Option 2: Environment variables

Add to your .env:
SENTRY_ORG_SLUG=your-organization-slug
SENTRY_AUTH_TOKEN=sntrys_your_token
SENTRY_URL=https://sentry.io           # optional, for self-hosted Sentry
SENTRY_PROJECT_SLUG=my-project         # optional, to scope to one project
VariableDefaultDescription
SENTRY_ORG_SLUGRequired. Your Sentry organization slug
SENTRY_AUTH_TOKENRequired. Sentry auth token with event:read
SENTRY_URLhttps://sentry.ioOverride for self-hosted Sentry
SENTRY_PROJECT_SLUGScope queries to a specific project

Option 3: Persistent store

{
  "version": 1,
  "integrations": [
    {
      "id": "sentry-prod",
      "service": "sentry",
      "status": "active",
      "credentials": {
        "base_url": "https://sentry.io",
        "organization_slug": "your-org",
        "auth_token": "sntrys_your_token",
        "project_slug": "my-project"
      }
    }
  ]
}

Creating an auth token

Recommended: Organization Token
  1. In Sentry, go to SettingsDeveloper SettingsOrganization Tokens
  2. Click Create New Token
  3. Enable the event:read scope
  4. Copy the token
Alternative: Internal Integration For broader access, create an Internal Integration under SettingsDeveloper SettingsInternal Integrations.
The organization slug appears in your Sentry URL: https://sentry.io/organizations/<slug>/

Verify

opensre integrations verify --service sentry
Expected output:
Service: sentry
Status: passed
Detail: Sentry validated for org your-org; issues API responded successfully with 5 issue(s)

Troubleshooting

SymptomFix
403 ForbiddenEnsure the token has event:read scope
Organization not foundVerify SENTRY_ORG_SLUG matches the slug in your Sentry URL
Connection refusedCheck SENTRY_URL for self-hosted instances
No issues returnedNormal if no issues exist in the time window — check SENTRY_PROJECT_SLUG

Security best practices

  • Use an Organization Token with only event:read — do not use admin tokens.
  • Store the token in .env, not in source code.
  • Rotate tokens periodically.