# How events are received

What the ingest accepts from the Sentry SDKs, the size limits, what it keeps and drops, and how it answers when a limit is reached.

The SDKs send to `https://errors.<domain>/api/<project number>/envelope/` (and the older `store/`
endpoint), and browsers post CSP reports to `…/security/`. Events are stored on Deutsche Cloud's own
machines, in the project's region.

## Authentication

The SDK names its DSN key in the `X-Sentry-Auth` or `Authorization: Sentry …` header, as
`sentry_key` in the query string, or in the envelope's own header (how a tunnel forwards it).

| Status | Message                                     | When                                             |
| ------ | ------------------------------------------- | ------------------------------------------------ |
| 401    | missing sentry_key                          | No key in any of those places                    |
| 401    | unknown or revoked DSN key                  | A key that does not exist or was revoked         |
| 403    | the DSN key does not belong to this project | The key is of another project than the URL names |

## What is received

| Item                                                                    | What happens                                                                                          |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `event` (errors, messages)                                              | Grouped into issues, stored for the project's retention                                               |
| `attachment` with its event in the same envelope                        | Stored with the event; one without its event, or over the size limit, is not kept                     |
| `client_report`                                                         | Counted on the **Stats** tab as dropped by the SDK, with its reasons                                  |
| `transaction` with its spans                                            | Stored for the project's retention: the trace view and the **Transactions** tab                       |
| `session`, `sessions`                                                   | Release health, kept 90 days (a Node.js server's process-wide session is counted, not kept)           |
| `profile`, `profile_chunk`                                              | Profiles, kept for the project's retention and at most 30 days                                        |
| A CSP report                                                            | Each violation becomes an error event; other report types are not kept                                |
| `span` (span streaming), replays, `check_in`, logs, `feedback`, metrics | Not supported yet: answered with a one-hour rate limit for that category, so the SDK stops sending it |

Bodies may be gzip, deflate, brotli or zstd. An envelope holds at most 1000 items. With the
platform's default settings, an event or a transaction may be up to 1 MiB, an attachment up to
1 MiB and a request up to 20 MiB decompressed. A larger transaction or attachment is dropped
without an error and counted on the **Stats** tab; the other refusals are answered:

| Status | Message                                       | When                                        |
| ------ | --------------------------------------------- | ------------------------------------------- |
| 400    | invalid envelope: more than 1000 items        | An envelope of more than 1000 items         |
| 413    | request body too large, or envelope too large | A request over 20 MiB, sent or decompressed |
| 413    | event larger than 1 MiB                       | An error event over 1 MiB                   |
| 415    | unsupported content encoding                  | Another `Content-Encoding`                  |

## What is changed on the way in

- With **Keep client IP addresses** off (the default), the sender's address is removed from the
  event and from its request headers; with it on, it is kept when the SDK asks for it (`{{auto}}`).
- A transaction's request cookies, credential headers (`Authorization`, `Cookie` and similar) and
  query strings, in URLs and span data, are removed.
- Stack frames are source-mapped with the uploaded maps (see
  [Upload source maps](upload-source-maps.md)).

An error event's other data is stored as sent: scrub what must not be stored in the SDK's
`beforeSend`, and keep `sendDefaultPii: false`.

## Limits and how they are answered

A refused request is answered `429` "rate limited" with `Retry-After` and `X-Sentry-Rate-Limits`
naming the refused categories, which the SDKs honour by pausing those categories. A refusal of
transactions in an envelope that also carries an error event, or of profiles in an envelope that
carries anything else, is not a `429`: the rest is taken, and the refusal rides on the `200`
answer as an `X-Sentry-Rate-Limits` entry.

| Limit                                           | Refuses                             | For                                                             |
| ----------------------------------------------- | ----------------------------------- | --------------------------------------------------------------- |
| The project's rate limit                        | errors                              | the rest of the minute                                          |
| A key's rate limit                              | errors, and separately transactions | the rest of the minute                                          |
| `errors.events-per-minute`                      | errors                              | the rest of the minute                                          |
| `errors.events-per-day`                         | errors                              | a minute at a time, until the UTC day ends                      |
| `errors.events-per-month`                       | errors                              | a minute at a time, until the month ends or the quota is raised |
| `errors.transactions-per-minute`, `…-per-month` | transactions only                   | as above                                                        |
| `errors.profiles-per-minute`, `…-per-month`     | profiles only                       | as above                                                        |
| `errors.stored-bytes`                           | every category                      | a minute at a time, until retention frees space                 |
| The event database unavailable                  | every category                      | ten seconds at a time, until it is back                         |

Per-minute limits are counted on each ingest machine separately, so with more than one machine the
effective ceiling is higher than the setting. When the ingest is busy, an item waits up to two
seconds for room. An error event that still finds none is answered `429` with a one-second
`Retry-After`, and so is a transaction sent without an error event. A transaction sent with an
error event, and profiles and sessions, that find no room were already acknowledged: they are
counted as lost on the **Stats** tab.

Every outcome is counted on the project's **Stats** tab with its reason: accepted, refused, not
kept, lost after acceptance, written late, or dropped by the SDK (see
[What happened to each event, and why](monitoring.md#what-happened-to-each-event-and-why)). An
alert rule **Events are refused or lost** tells you when it happens (see
[Create an alert rule](create-an-alert-rule.md)).

## Related

- [Quotas](quotas.md)
- [Change project settings](change-project-settings.md)
