Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Project: Metrics Rate Limits #77

@stephanie-anderson

Description

@stephanie-anderson

Description

In order to protect our infrastructure and also customers money, Relay is now able to propagate the limits from processing to PoP Relays and further to our SDKs. We need to make sure that all SDKs can stop sending metrics for some orgs (e.g. above quota, abusing Sentry).

The develop specs for this can be found here:
https://develop.sentry.dev/sdk/rate-limiting/

The tracking issue for the Ingest team is:
https://github.com/getsentry/team-ingest/issues/303

A quick TL;DR: How to Implement

Add a new data category to the existing rate limiter code, called metric_bucket.
A new parameter called namespaces might be returned for the metric_bucket category.
If the returned namespaces contain custom, back off transmitting metrics from the SDK.
If the returned namespaces exclusively contain namespaces other than custom, do not back off transmitting metrics from the SDK.
If the namespaces are empty (2700:metric_bucket:organization:quota_exceeded:) or omitted (2700:metric_bucket:organization:quota_exceeded) in the response header, back off transmitting metrics from the SDK.
While we do not support setting metric namespaces in the SDK yet, Relay could return a X-Sentry-Rate-Limits header that contains a different metric namespace only, e.g. transaction.
In case your SDK supports client outcomes, report rate limited metrics as the metric_bucket category.

Get inspired by Python SDK PR #1 or PHP PR #1 and PHP PR #2.

Why should we be doing this?

We need to protect our infrastructure and respect communicated rate limits.

Why now?

We didn't plan this for the metrics beta, but metrics is adopted pretty well.

Slack-Channel

#discuss-ingest

Stakeholder(s)

Ingest team (esp. Oleksandr & Jan)

Team(s)

Mobile, Web Frontend, Web Backend

Implementation Status

### Web Backend SDKs
- [ ] https://github.com/getsentry/sentry-php/issues/1723
- [ ] https://github.com/getsentry/sentry-python/issues/2921
- [ ] https://github.com/getsentry/sentry-java/issues/3292
- [ ] https://github.com/getsentry/sentry-ruby/issues/2282
- [ ] https://github.com/getsentry/sentry-dotnet/issues/3248
- [x] Unity: should get it via https://github.com/getsentry/sentry-dotnet/issues/3248
- [x] Unreal doesn't support Metrics yet
- [x] Elixir doesn't support Metrics yet
- [x] Go doesn't support Metrics yet
### Web Frontend SDKs
- [ ] https://github.com/getsentry/sentry-javascript/issues/11336
### Mobile SDKs
- [x] Android: should get it via https://github.com/getsentry/sentry-java/issues/3292
- [ ] https://github.com/getsentry/sentry-dart/issues/1957
- [ ] https://github.com/getsentry/sentry-cocoa/issues/3805
- [x] React Native https://github.com/getsentry/sentry-react-native/releases/tag/5.22.0

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions