From 8a00d5d573765f5cb902f816170a28f2ceb69df7 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 8 Sep 2025 11:46:33 -0400 Subject: [PATCH 1/2] feat(logs): Add `sentry.replay_id` to logs spec --- develop-docs/sdk/telemetry/logs.mdx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/develop-docs/sdk/telemetry/logs.mdx b/develop-docs/sdk/telemetry/logs.mdx index 296c048e9db3d..89ebbbe31bf58 100644 --- a/develop-docs/sdk/telemetry/logs.mdx +++ b/develop-docs/sdk/telemetry/logs.mdx @@ -275,6 +275,7 @@ By default the SDK should attach the following attributes to a log: 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. ```json { @@ -282,7 +283,8 @@ By default the SDK should attach the following attributes to a log: "sentry.release": "1.0.0", "sentry.trace.parent_span_id": "b0e6f15b45c36b12", "sentry.sdk.name": "sentry.javascript.node", - "sentry.sdk.version": "9.11.0" + "sentry.sdk.version": "9.11.0", + "sentry.replay_id": "36b75d9fa11f45459412a96c41bdf691" } ``` @@ -393,6 +395,18 @@ SDKs should aim to have it so that console/logger integrations create logs as pe If SDK authors feel the need, they can also introduce additional options to beyond `enableLogs`/`enable_logs` to gate this functionality. For example an option to control log appenders added via external config like with `Log4j` in the Java SDK. +### Behaviour with other Sentry Telemetry + +#### 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. + +#### Replays + +Logs should be associated with replays if possible. If a log is recorded during an active replay, the SDK should set the `sentry.replay_id` attribute to the replay id of the replay that was active when the log was collected. + +In the future we will support attaching replay id's to logs by reading `sentry.replay_id` from the Dynamic Sampling Context (baggage). This allows server-side SDKs to attach the replay id their logs. + ### Other If `debug` is set to `true` in SDK init, calls to the Sentry logger API should also print to the console with the appropriate log level. This will help debugging logging setups. From 0602f2af351eabea7a81b635f4f1bf83bbc91b15 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 10 Sep 2025 10:47:32 -0400 Subject: [PATCH 2/2] remove future note --- develop-docs/sdk/telemetry/logs.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/develop-docs/sdk/telemetry/logs.mdx b/develop-docs/sdk/telemetry/logs.mdx index 89ebbbe31bf58..68787b42352e5 100644 --- a/develop-docs/sdk/telemetry/logs.mdx +++ b/develop-docs/sdk/telemetry/logs.mdx @@ -405,8 +405,6 @@ Logs should be associated with traces if possible. If a log is recorded during a Logs should be associated with replays if possible. If a log is recorded during an active replay, the SDK should set the `sentry.replay_id` attribute to the replay id of the replay that was active when the log was collected. -In the future we will support attaching replay id's to logs by reading `sentry.replay_id` from the Dynamic Sampling Context (baggage). This allows server-side SDKs to attach the replay id their logs. - ### Other If `debug` is set to `true` in SDK init, calls to the Sentry logger API should also print to the console with the appropriate log level. This will help debugging logging setups.