getsentry / team-sdks

A meta repository for tracking work across all SDK teams.
0 stars 0 forks source link

Report dropped spans in client reports #88

Open cleptric opened 1 week ago

cleptric commented 1 week ago

Description

SDKs that emit client reports today should record an additional dropped span category event when a transaction is dropped, containing the number of the spans inside the transaction plus one. The plus one stems from the fact that Relay extracts an additional span from the transaction. If a transaction contains no spans, we still want to report one dropped transaction and one dropped span. This also applies to transactions that are not sampled. If certain spans are dropped in beforeSendTransaction, an event processor etc., we also want to report those if feasible.

{
    "discarded_events": [
        {
            "reason": "something",
            "category": "transaction",
            "quantity": 1
        },
        {
            "reason": "something",
            "category": "span",
            "quantity": 3 // 2 spans + 1 span (the transaction itself should be counted)
        }
    ]
}

See https://www.notion.so/sentry/Rate-Limited-Outcomes-for-Nested-Spans-in-Transactions-1ba24e34bdb64e9498aa5c03ecb28ba0?d=eeb2093683d541f5996e6eb804713236#3c019a03b165493d989440bc67c8c5be for more details.


SDKs which emit standalone spans today, should additionally implement handling span category rate limits, which only apply to standalone spans.

Why should we be doing this?

We need to to be able to report over quota and other rejection stats for AM3 customers. As we currently do not emit this data, the billing page shows spans as zero.

Why now?

We didn’t understand the full extend of the reporting of outcomes before hand, hence this came up post AM3 launch.

Stakeholder(s)

@phacops @cleptric

Team(s)

All SDK teams

### SDKs
- [ ] https://github.com/getsentry/sentry-java/issues/3527
- [ ] Transfer documentation from Notion to develop docs
- [ ] iOS
- [ ] RN
- [ ] https://github.com/getsentry/sentry-dart/issues/2137
- [ ] https://github.com/getsentry/sentry-dotnet/issues/3458
- [ ] https://github.com/getsentry/sentry-python/issues/3229
- [ ] https://github.com/getsentry/sentry-javascript/issues/12727
- [ ] Ruby