Skip to content
Merged
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
19 changes: 9 additions & 10 deletions develop-docs/sdk/telemetry/logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The `log` envelope item payload is a JSON object that represents a Sentry Log.
{
"timestamp": 1544719860.0,
"trace_id": "5b8efff798038103d269b633813fc60c",
"span_id": "b0e6f15b45c36b12",
"level": "info",
"body": "User John has logged in!",
"attributes": {
Expand All @@ -58,10 +59,6 @@ The `log` envelope item payload is a JSON object that represents a Sentry Log.
"sentry.release": {
"value": "1.0.0",
"type": "string"
},
"sentry.trace.parent_span_id": {
"value": "b0e6f15b45c36b12",
"type": "string"
}
}
}
Expand All @@ -77,6 +74,10 @@ It consists of the following fields:

: **String, required**. The trace id of the log. The value should be 16 random bytes encoded as a hex string (32 characters long). The trace id should be grabbed from the current propagation context in the SDK.

`span_id`

: **String, optional**. The span id of the span that was active when the log was collected. The value should be 8 random bytes encoded as a hex string (16 characters long). The span id should be grabbed from the current active span in the SDK.

`level`

: **String, required**. The severity level of the log. One of `trace`, `debug`, `info`, `warn`, `error`, `fatal` (in order of lowest to highest).
Expand Down Expand Up @@ -274,16 +275,14 @@ By default the SDK should attach the following attributes to a log:

1. `sentry.environment`: The environment set in the SDK if defined.
2. `sentry.release`: The release set in the SDK if defined.
3. `sentry.trace.parent_span_id`: The span id of the span that was active when the log was collected. This should not be set if there was no active span.
4. `sentry.sdk.name`: The name of the SDK that sent the log
5. `sentry.sdk.version`: The version of the SDK that sent the log
6. `sentry.replay_id`: The replay id of the replay that was active when the log was collected. This should not be set if there was no active replay.
3. `sentry.sdk.name`: The name of the SDK that sent the log
4. `sentry.sdk.version`: The version of the SDK that sent the log
5. `sentry.replay_id`: The replay id of the replay that was active when the log was collected. This should not be set if there was no active replay.

```json
{
"sentry.environment": "production",
"sentry.release": "1.0.0",
"sentry.trace.parent_span_id": "b0e6f15b45c36b12",
"sentry.sdk.name": "sentry.javascript.node",
"sentry.sdk.version": "9.11.0",
"sentry.replay_id": "36b75d9fa11f45459412a96c41bdf691"
Expand Down Expand Up @@ -411,7 +410,7 @@ If SDK authors feel the need, they can also introduce additional options to beyo

#### Tracing

Logs should be associated with traces if possible. If a log is recorded during an active span, the SDK should set the `sentry.trace.parent_span_id` attribute to the span id of the span that was active when the log was collected.
Logs should be associated with traces if possible. If a log is recorded during an active span, the SDK should set the `span_id` property of the log to the span id of the span that was active when the log was collected.

#### Replays

Expand Down
Loading