Skip to content

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Sep 26, 2025

So far, dev docs have been used to inform SDK developers on which data categories to apply to which envelope items. It has been brought up that this list is not always complete, and that developers sometimes check the DataCategory definition in Relay for a more complete picture, since it is the source of truth of data categories used across Sentry. This however raises new questions, as it is not always clear what relevance the categories have per SDK.

Add a line to each doc comment for clarification.

INGEST-573.

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Just some discussion items, which we don't have to resolve here (or at all).

Default = 0,
/// Error events and Events with an `event_type` not explicitly listed below.
///
/// SDK rate limiting behavior: apply to envelope items of type `event`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not just events, but the entire envelope. Which is implied by the protocol, but maybe not obvious to everyone?

Error = 1,
/// Transaction events.
///
/// SDK rate limiting behavior: apply to envelope items of type `transaction`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with Errors

Uptime = 21,
/// Counts the number of individual attachments, as opposed to the number of bytes in an attachment.
///
/// SDK rate limiting behavior: apply to attachments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe for attachments, also profiles Relay should do the transformation from Item or Duration to just a single category?

pub enum DataCategory {
/// Reserved and unused.
///
/// SDK rate limiting behavior: ignore.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should this be "apply to all"?

Transaction = 2,
/// Events with an event type of `csp`, `hpkp`, `expectct` and `expectstaple`.
///
/// SDK rate limiting behavior: ignore (?).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://develop.sentry.dev/sdk/data-model/envelope-items/#reserved-types

Suggested change
/// SDK rate limiting behavior: ignore (?).
/// SDK rate limiting behavior: ignore.

/// This is the category for transaction payloads that were accepted and stored in full. In
/// contrast, `transaction` only guarantees that metrics have been accepted for the transaction.
///
/// SDK rate limiting behavior: ignore.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data may still be ingested even though we do not index it.

///
/// This is the category for spans from which we extracted metrics from.
///
/// SDK rate limiting behavior: apply to spans that are not sent in a transaction.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dav1dde or should the SDK already limit transactions here? See https://develop.sentry.dev/ingestion/relay/transaction-span-ratelimits/#enforcement.

IMO no, it is up to the server (relay + sentry) to propagate a rate limit for both if we don't want either spans nor transactions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Relay should propagate a TRANSACTION rate limit also to SPANS (if that's the desired behaviour).

///
/// See also: [`Self::ProfileDuration`]
///
/// SDK rate limiting behavior: ignore.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? cc @getsentry/profiling

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what exactly this comment means? I'm not sure I understand.

But in general, ProfileDurationUi should behave the same as ProfileDuration and ProfileChunkUi should behave the same as ProfileChunk as they're just used for different platforms.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zylphrex if an SDK receives a rate limit header with this data category, should it stop sending profiling data to sentry? Or is it an internal data category that SDKs should not worry about?

@jjbayer jjbayer marked this pull request as ready for review September 26, 2025 09:58
@jjbayer jjbayer requested a review from a team as a code owner September 26, 2025 09:58
@jjbayer jjbayer requested review from cleptric and a team and removed request for a team September 26, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants