# Sentry

Sentry is an application monitoring and error tracking platform that helps developers identify, triage, and resolve code errors in real-time. The Sling Sentry connector extracts data from the Sentry REST API, supporting organizations, projects, teams, members, issues, events, and releases.

{% hint style="success" %}
**CLI Pro Required**: APIs require a [CLI Pro token](https://docs.slingdata.io/sling-cli/cli-pro) or [Platform Plan](https://docs.slingdata.io/sling-platform/platform).
{% endhint %}

## Setup

The following credentials and inputs are accepted:

**Secrets:**

* `auth_token` **(required)** -> Your Sentry Auth Token (Personal or Organization)

**Inputs:**

* `organization` **(required)** -> The Sentry organization slug to extract data from
* `anchor_date` (optional) -> The starting date for historical data extraction (default: 1 year ago). Format: `YYYY-MM-DDTHH:MM:SSZ`

### Getting Your Auth Token

1. Go to [Sentry Settings > Auth Tokens](https://sentry.io/settings/auth-tokens/)
2. Click "Create New Token"
3. Give your token a descriptive name (e.g., "Sling Integration")
4. Select the required permissions:
   * **Project**: Read
   * **Team**: Read
   * **Issue & Event**: Read
   * **Organization**: Read
   * **Member**: Read
   * **Release**: Admin (no Read-only option available)
5. Click "Create Token" and copy the token (it starts with `sntryu_`)

### Using `sling conns`

Here are examples of setting a connection named `SENTRY`. We must provide the `type=api` property:

{% code overflow="wrap" %}

```bash
sling conns set SENTRY type=api spec=sentry \
  secrets='{ auth_token: sntryu_xxxxxxxxxxxx }' \
  inputs='{ organization: my-org }'
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/sling-cli/environment#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export SENTRY='{ type: api, spec: sentry, secrets: { auth_token: "sntryu_xxxxxxxxxxxx" }, inputs: { organization: "my-org" } }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/sling-cli/environment#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  SENTRY:
    type: api
    spec: sentry
    secrets:
      auth_token: "sntryu_xxxxxxxxxxxx"
    inputs:
      organization: my-org
```

**With anchor date for historical data:**

```yaml
connections:
  SENTRY:
    type: api
    spec: sentry
    secrets:
      auth_token: "sntryu_xxxxxxxxxxxx"
    inputs:
      organization: my-org
      anchor_date: "2024-01-01T00:00:00Z"
```

## Replication

Here's an example replication configuration to sync Sentry data to a PostgreSQL database:

```yaml
source: SENTRY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: sentry.{stream_name}

streams:
  # Organization & team data
  organizations:
  projects:
  teams:
  members:
  releases:

  # Incremental error tracking data
  issues:
    mode: incremental
    primary_key: [id]
    update_key: last_seen
  events:
    mode: incremental
    primary_key: [event_id]
    update_key: date_created
```

**Sync all endpoints with incremental where supported:**

```yaml
source: SENTRY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: sentry.{stream_name}

streams:
  '*':
```

## Endpoints

| Endpoint        | Description                                         | Incremental |
| --------------- | --------------------------------------------------- | ----------- |
| `organizations` | Organization details (name, slug, status, features) | No          |
| `projects`      | All projects in the organization with metadata      | No          |
| `teams`         | All teams in the organization                       | No          |
| `members`       | Organization members with roles and invite status   | No          |
| `releases`      | Releases across the organization                    | No          |
| `issues`        | Issues (errors/problems) filtered by lastSeen date  | Yes         |
| `events`        | Error events for each project with stack traces     | Yes         |

To discover available endpoints:

```bash
sling conns discover SENTRY
```

## Rate Limiting

The Sentry API has rate limits that vary by endpoint and plan:

* **Free tier:** \~20 requests/second
* **Paid plans:** Higher limits

The connector automatically:

* Uses conservative rate limiting (3 requests/second)
* Limits concurrency to 2 parallel requests
* Retries with exponential backoff on 429 (rate limit) responses
* Retries on 5xx server errors
* Stops on 403 (access denied) responses

## Common Use Cases

### Error Monitoring Dashboard

```yaml
source: SENTRY
target: MY_POSTGRES

defaults:
  object: error_monitoring.{stream_name}

streams:
  issues:
    mode: incremental
    primary_key: [id]
    update_key: last_seen
  events:
    mode: incremental
    primary_key: [event_id]
    update_key: date_created
  projects:
    mode: full-refresh
```

### Organization & Team Overview

```yaml
source: SENTRY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: sentry_meta.{stream_name}

streams:
  organizations:
  projects:
  teams:
  members:
  releases:
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.slingdata.io/connections/api-connections/sentry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
