Skip to content

feat(logs): initial work on develop docs for sdk logging api #12920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cc06312
feat(logs): intial work on develop docs for sdk logging api
AbhiPrasad Mar 4, 2025
a6a8091
feat: Document otel_log envelope
AbhiPrasad Mar 5, 2025
20cfb44
ref: Clean up logs spec
AbhiPrasad Mar 5, 2025
ba6d2dd
fix link to logs pages
AbhiPrasad Mar 5, 2025
7e4a0cb
Apply suggestions from code review
AbhiPrasad Mar 6, 2025
e5f87ea
Update develop-docs/sdk/telemetry/logs.mdx
AbhiPrasad Mar 6, 2025
cc48024
Update develop-docs/sdk/telemetry/logs.mdx
AbhiPrasad Mar 11, 2025
0540762
fix: close code block
AbhiPrasad Mar 11, 2025
07f741b
fix: Specify that intValue is a string
AbhiPrasad Mar 11, 2025
60c3bdc
fix: Cursor got the change wrong
AbhiPrasad Mar 11, 2025
ff4f76e
Merge branch 'master' into abhi-logs-sdk-developer-documentation
AbhiPrasad Mar 20, 2025
3ff6e56
Document log envelope item payload
AbhiPrasad Mar 20, 2025
2d2abe8
enable_sentry_logs -> enable_logs
AbhiPrasad Mar 20, 2025
ab38e6e
note about overloading method
AbhiPrasad Mar 20, 2025
5ea9d7d
remove log method
AbhiPrasad Mar 20, 2025
9d7302b
remove emit
AbhiPrasad Mar 20, 2025
6dc07e6
remove obj-c
AbhiPrasad Mar 20, 2025
28cb4b5
add note about crashes
AbhiPrasad Mar 20, 2025
824a186
Document rate limiting and client outcomes
AbhiPrasad Mar 20, 2025
9a130c1
update spec based on attribute changes
AbhiPrasad Mar 27, 2025
75ce009
Merge branch 'master' into abhi-logs-sdk-developer-documentation
AbhiPrasad Apr 7, 2025
021d442
document sentry.origin log attribute
AbhiPrasad Apr 7, 2025
c35358a
Make sentry.message.parameter singular matching otel conventions
AbhiPrasad Apr 7, 2025
f8a5fda
clarify message parameter attribute and document sdk name/version att…
AbhiPrasad Apr 7, 2025
77d0b95
feat: Document server.address
AbhiPrasad Apr 8, 2025
5fa1be2
Merge branch 'master' into abhi-logs-sdk-developer-documentation
AbhiPrasad Apr 14, 2025
4f667af
clarify sampling controls
AbhiPrasad Apr 14, 2025
4ce5d4d
fix 404 link
AbhiPrasad Apr 14, 2025
b3f8c65
Add details about new log envelope item container
AbhiPrasad Apr 16, 2025
f5fc96f
move appendix into expandable
AbhiPrasad Apr 22, 2025
bc4f23f
Merge branch 'master' into abhi-logs-sdk-developer-documentation
AbhiPrasad Apr 22, 2025
6251603
fix 404 to trace origin
AbhiPrasad Apr 22, 2025
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
189 changes: 126 additions & 63 deletions develop-docs/sdk/data-model/envelope-items.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ encoded in JSON.
`event_id`

: **UUID String, required.** Corresponds to the `event_id` field of the event
payload. Clients are required to generate an event identifier ahead of time
and set it at least in the Envelope headers. If the identifier mismatches
between the Envelope and payload, the Envelope header takes precedence.
payload. Clients are required to generate an event identifier ahead of time
and set it at least in the Envelope headers. If the identifier mismatches
between the Envelope and payload, the Envelope header takes precedence.

**Additional Item Headers:**

*None*
_None_

### Transaction

Expand All @@ -52,14 +52,14 @@ in JSON.
`event_id`

: **UUID String, required.** Corresponds to the `event_id` field of the
transaction payload. Clients are required to generate an event identifier
ahead of time and set it at least in the Envelope headers. If the identifier
mismatches between the Envelope and payload, the Envelope header takes
precedence.
transaction payload. Clients are required to generate an event identifier
ahead of time and set it at least in the Envelope headers. If the identifier
mismatches between the Envelope and payload, the Envelope header takes
precedence.

**Additional Item Headers:**

*None*
_None_

### Attachment

Expand Down Expand Up @@ -91,27 +91,27 @@ file. It is always associated to an event or transaction.

`filename`

: **String, required.** The name of the uploaded file without a path component.
: **String, required.** The name of the uploaded file without a path component.

`attachment_type`

: *String, optional.* The special type of this attachment. Possible values are:
: _String, optional._ The special type of this attachment. Possible values are:

- **`event.attachment` (default)**: A standard attachment without special
meaning.
- `event.minidump`: A minidump file that creates an error event and is
symbolicated. The file should start with the `MDMP` magic bytes.
- `event.applecrashreport`: An Apple crash report file that creates an error
event and is symbolicated.
- `unreal.context`: An XML file containing UE4 crash meta data. During event
ingestion, event contexts and extra fields are extracted from this file.
- `unreal.logs`: A plain-text log file obtained from UE4 crashes. During
event ingestion, the last logs are extracted into event breadcrumbs.
- `event.view_hierarchy`: An JSON file with a predefined structure, see [RFC #33](https://github.com/getsentry/rfcs/blob/main/text/0033-view-hierarchy.md).
- **`event.attachment` (default)**: A standard attachment without special
meaning.
- `event.minidump`: A minidump file that creates an error event and is
symbolicated. The file should start with the `MDMP` magic bytes.
- `event.applecrashreport`: An Apple crash report file that creates an error
event and is symbolicated.
- `unreal.context`: An XML file containing UE4 crash meta data. During event
ingestion, event contexts and extra fields are extracted from this file.
- `unreal.logs`: A plain-text log file obtained from UE4 crashes. During
event ingestion, the last logs are extracted into event breadcrumbs.
- `event.view_hierarchy`: An JSON file with a predefined structure, see [RFC #33](https://github.com/getsentry/rfcs/blob/main/text/0033-view-hierarchy.md).

`content_type`

: *String, optional.* The content type of the attachment payload. Any [MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) may be used; the default is `application/octet-stream`.
: _String, optional._ The content type of the attachment payload. Any [MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) may be used; the default is `application/octet-stream`.

### Session

Expand All @@ -124,11 +124,11 @@ details.
**Constraints:**

- This Item may occur multiple times per Envelope.
- Ingestion may limit the maximum number of Items per Envelope, see *Ingestion*.
- Ingestion may limit the maximum number of Items per Envelope, see _Ingestion_.

**Additional Item Headers:**

*None*
_None_

### Sessions

Expand All @@ -140,11 +140,11 @@ details.
**Constraints:**

- This Item may occur multiple times per Envelope.
- Ingestion may limit the maximum number of Items per Envelope, see *Ingestion*.
- Ingestion may limit the maximum number of Items per Envelope, see _Ingestion_.

**Additional Item Headers:**

*None*
_None_

### Statsd (deprecated)

Expand All @@ -156,11 +156,11 @@ details.
**Constraints:**

- This Item may occur multiple times per Envelope.
- Ingestion may limit the maximum number of Items per Envelope, see *Ingestion*.
- Ingestion may limit the maximum number of Items per Envelope, see _Ingestion_.

**Additional Item Headers:**

*None*
_None_

### Metric Meta (deprecated)

Expand All @@ -173,17 +173,18 @@ details.
**Constraints:**

- This Item may occur multiple times per Envelope.
- Ingestion may limit the maximum number of Items per Envelope, see *Ingestion*.
- Ingestion may limit the maximum number of Items per Envelope, see _Ingestion_.

**Additional Item Headers:**

*None*
_None_

### User Feedback

Item type `"feedback"`. This Item contains an [event payload](/sdk/data-model/event-payloads/) encoded in JSON, with an additional `feedback` context object.

Example payload:

```json
{
"event_id": "9ec79c33ec9942ab8353589fcb2e04dc",
Expand All @@ -197,7 +198,7 @@ Example payload:
"message": "I love session replay!",
"url": "https://sentry.io/replays/",
"associated_event_id": "32fd1995636d446385016e2747623e11",
"replay_id":"82840977e85b4ed3bc27f7b5b25cec15"
"replay_id": "82840977e85b4ed3bc27f7b5b25cec15"
}
}
}
Expand All @@ -215,26 +216,26 @@ feedback. The max length is **4096 characters**.

`contact_email`

: *String, optional.* The email of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.
: _String, optional._ The email of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.

`name`

: *String, optional.* The name of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.
: _String, optional._ The name of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.

`url`

: *String, optional.* The URL of the webpage the user was on when submitting feedback.
This may be used to search for or set alerts on feedback.
: _String, optional._ The URL of the webpage the user was on when submitting feedback.
This may be used to search for or set alerts on feedback.

`associated_event_id`

: *UUID String, optional.* The identifier of an error event in the same project.
Use this to explicitly link a related error in the feedback UI.
: _UUID String, optional._ The identifier of an error event in the same project.
Use this to explicitly link a related error in the feedback UI.

`replay_id`

: *UUID String, optional.* The identifier of a related Session Replay in the same
project. Sentry uses this ID to render a Replay clip in the feedback UI.
: _UUID String, optional._ The identifier of a related Session Replay in the same
project. Sentry uses this ID to render a Replay clip in the feedback UI.

**Attaching Screenshots:**

Expand All @@ -253,10 +254,10 @@ Envelope.
`event_id`

: **UUID String, required.** Corresponds to the `event_id` field of the event
payload. **It is not equal to the `associated_event_id`** field in the feedback
context. Clients are required to generate an event identifier ahead of time
and set it at least in the Envelope headers. If the identifier mismatches
between the Envelope and payload, the Envelope header takes precedence.
payload. **It is not equal to the `associated_event_id`** field in the feedback
context. Clients are required to generate an event identifier ahead of time
and set it at least in the Envelope headers. If the identifier mismatches
between the Envelope and payload, the Envelope header takes precedence.

### User Report - Deprecated

Expand All @@ -265,6 +266,7 @@ Item type `"user_report"`. This is an older, deprecated way of submitting user f
This item works by associating user information and comments with an event. If both the item and its associated event are accepted, we convert it to a user feedback.

The item contains a JSON payload like this:

```json
{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","email":"[email protected]","name":"John Me","comments":"It broke."}\n
```
Expand All @@ -278,15 +280,15 @@ an error.

`email`

: *String, recommended.* The email of the user.
: _String, recommended._ The email of the user.

`name`

: *String, recommended.* The name of the user.
: _String, recommended._ The name of the user.

`comments`

: *String, recommended.* Comments of the user about what happened. The max length is **4096 characters**.
: _String, recommended._ Comments of the user about what happened. The max length is **4096 characters**.

**Constraints:**

Expand All @@ -303,12 +305,12 @@ an error.
`event_id`

: **UUID String, required.** Corresponds to the `event_id` field of the payload.
If the identifier mismatches between the Envelope and payload, the Envelope
header takes precedence.
If the identifier mismatches between the Envelope and payload, the Envelope
header takes precedence.

**Additional Item Headers:**

*None*
_None_

### Client Report

Expand All @@ -324,11 +326,11 @@ details.

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

*None*
_None_

### Replay Event

Expand All @@ -344,15 +346,15 @@ details.

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

*None*
_None_

### Replay Recording

Item type `"replay_recording"` contains a replay recording payload encoded in JSON *or* a gzipped JSON.
Item type `"replay_recording"` contains a replay recording payload encoded in JSON _or_ a gzipped JSON.

See the <Link to="/sdk/telemetry/replays/">replays</Link> documentation for the payload
details.
Expand All @@ -364,7 +366,7 @@ details.

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

Expand All @@ -384,11 +386,11 @@ in JSON.

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

*None*
_None_

### Profile Chunk

Expand All @@ -397,15 +399,15 @@ in JSON.

**Constraints:**

*None*
_None_

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

*None*
_None_

### Check-Ins

Expand All @@ -421,11 +423,72 @@ details.

**Envelope Headers:**

*None*
_None_

**Additional Item Headers:**

_None_

### Log

Item type `"log"` contains an array of log payloads encoded as JSON. This allows for multiple log payloads to be sent in a single envelope item.

Only a single log item is allowed per envelope. The `item_count` field in the envelope item header must match the amount of logs sent, it's not optional. A `content_type` field in the envelope item header must be set to `application/vnd.sentry.items.log+json`.

It's okay to mix logs from different traces into the same log envelope item, but if you do, you MUST not attach a DSC (dynamic sampling context) to the envelope header.

See the <Link to="/sdk/telemetry/logs">Logs</Link> documentation for the payload
details.

Example:

```json
{
"type": "log",
"item_count": 5,
"content_type": "application/vnd.sentry.items.log+json"
}
{
"items": [{..log..}, {..log..}, {..log..}, {..log..}, {..log..}]
}
```

**Constraints:**

_None_

**Envelope Headers:**

_None_

**Additional Item Headers:**

`item_count`

: **integer, required.** The number of log items in the envelope.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
: **integer, required.** The number of log items in the envelope.
: **integer, required.** The number of log entries in the item.

It's just scoped to the item, unfortunately naming clashes here "log item" and "envelope item"

Copy link
Member Author

Choose a reason for hiding this comment

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

Naming is hard - good catch, will fix.


`content_type`

: **string, required.** The content type of the log items. Must be `application/vnd.sentry.items.log+json`.

### Otel Logs

Item type `"otel_log"` contains an OpenTelemetry Logs payload encoded as JSON. Multiple Otel log envelope items can be sent in a single envelope.

See the <Link to="/sdk/telemetry/logs">Logs</Link> documentation for the payload
details.

**Constraints:**

_None_

**Envelope Headers:**

_None_

**Additional Item Headers:**

*None*
_None_

### Reserved Types

Expand Down
Loading