Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ This exact flow is not enforced for all SDKs. SDKs **MAY** adapt the architectur

We aim to standardize requirements so SDKs share consistent logic across platforms. This benefits multi-platform SDKs like Java. However, requirements **MAY** differ where necessary. This page outlines common requirements; platform-specific requirements are listed [below](#platform-specific-requirements).

For rules on which items can be combined in a single envelope, see [Envelope Item Constraints](/sdk/foundations/transport/envelope-items/#envelope-item-constraints). These constraints impact the design — for example, the [span buffer](#span-buffer) organizes spans per traceID because each envelope can only contain spans from a single trace, while logs and metrics can be batched across traces.

# Telemetry Buffer

The telemetry buffer batches high-volume data and forwards it to the telemetry scheduler. This section covers the common requirements for all platforms:
Expand Down
27 changes: 27 additions & 0 deletions develop-docs/sdk/foundations/transport/envelope-items.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ title: Envelope Items
sidebar_order: 80
---

<Alert>
This document uses key words such as "MUST", "SHOULD", and "MAY" as defined
in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement
levels.
</Alert>

Each Envelope consists of headers and a potentially empty list of Items, each
with their own headers. Which Headers are required depends on the Items in an
Envelope. This section describes all Item types and their respective required
Expand All @@ -14,6 +20,27 @@ The type of an Item is declared in the `type` header, as well as the payload
size in `length`. See Serialization Format for a list of common Item headers.
The headers described in this section are **in addition to the common headers**.

## Envelope Item Constraints

SDKs **SHOULD NOT** combine different types of telemetry data in the same envelope, because Relay enforces [rate limits](/sdk/foundations/transport/rate-limiting/) per [data category](/sdk/foundations/transport/rate-limiting/#definitions), and mixing types makes this enforcement more expensive. Exceptions to this rule are listed below (e.g., sessions, client reports, and attachments **MAY** be combined with other items).
Copy link
Member Author

Choose a reason for hiding this comment

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

@cleptric, I added a comment for this on the initial GitHub issue #16188 (comment), but I'm not 100% sure if this is actually the case.

And maybe we should even change this to: SDKs MUST NOT combine different types of telemetry data in the same envelope. Please let me know.


The following constraints apply:

1. **Mutual exclusivity**:
- [`event`](#event) and [`transaction`](#transaction) envelope items are mutually exclusive.
- [`feedback`](/sdk/telemetry/feedbacks/#envelope-item-constraints) and [`transaction`](#transaction) envelope items are mutually exclusive.
2. **Spans**: An envelope **MUST** contain at most one envelope item containing spans, and all spans **MUST** share a single traceID; see [Span Buffer](/sdk/telemetry/spans/span-buffer/).
Copy link
Member Author

Choose a reason for hiding this comment

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

@cleptric I'm not 100% sure if that's actually the case that you can only send one envelope item containing spans per envelope. If not, I will adjust the docs here accordingly.

3. **Logs**: An envelope **MUST** contain at most one envelope item containing logs. Logs from different traces **MAY** be mixed in the same envelope item, but if they are, the envelope **MUST NOT** include a [DSC](/sdk/foundations/trace-propagation/dynamic-sampling-context/) header; see [Logs](/sdk/telemetry/logs/#log-envelope-item).
4. **Metrics**: An envelope **MUST** contain at most one envelope item containing metrics. Metrics from different traces **MAY** be mixed in the same envelope item, but if they are, the envelope **MUST NOT** include a [DSC](/sdk/foundations/trace-propagation/dynamic-sampling-context/) header; see [Metrics](/sdk/telemetry/metrics/#trace_metric-envelope-item).
5. **Sessions**: Multiple envelope items containing sessions **MAY** appear in a single envelope; see [Sessions](/sdk/telemetry/sessions/#session-update-payload).
6. **Attachments**: Multiple envelope items containing attachments **MAY** appear in a single envelope. Minidump and Apple crash report attachment envelope items **MUST** be sent in the same envelope as their event; see [Attachments](/sdk/telemetry/attachments/#standard-attachments).
7. **Check-ins**: An envelope **MUST** contain at most one envelope item containing a check-in; see [Check-Ins](/sdk/telemetry/check-ins/#envelope-constraints).
8. **Client reports**: Multiple envelope items containing client reports **MAY** appear in a single envelope; see [Client Reports](/sdk/telemetry/client-reports/#wire-format).
9. **Replays**: The `replay_event` and `replay_recording` envelope items **MUST** always be sent together in the same envelope; see [Replay](/sdk/telemetry/replays/#replay-event-payload).
10. **User reports (deprecated)**: `user_report` envelope items **SHOULD** be sent in the same envelope as their associated event; see [User Reports](/sdk/telemetry/user-reports/#envelope-item).

## Envelope Item Types

### Event

Item type `"event"`. This Item contains an error or default [event payload](/sdk/foundations/transport/event-payloads/)
Expand Down
Loading