Skip to content

✨ attach debug_ids to logs events - #4982

Open
amortemousque wants to merge 3 commits into
mainfrom
aymeric/debug-id-logs
Open

✨ attach debug_ids to logs events#4982
amortemousque wants to merge 3 commits into
mainfrom
aymeric/debug-id-logs

Conversation

@amortemousque

@amortemousque amortemousque commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Part of the sourcemap unminification project. RUM error / long task / profiler events already carry _dd.debug_ids. This does the same for the Logs SDK, so minified stacks collected through @datadog/browser-logs can be unminified too.

Changes

_dd.debug_ids is now attached to logs events from: runtimeErrorCollection, consoleCollection, reportCollection, logger

Test instructions

yarn test:e2e -g "debug_id"

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Forward the `debugIds` resolved from the source code context to logs
events as `_dd.debug_ids`, for runtime errors, console errors, reports
and manual `logger.error` calls. Reports now derive both their stack and
their debug ids from a single source location.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@amortemousque
amortemousque marked this pull request as ready for review August 26, 2026 08:41
@amortemousque
amortemousque requested a review from a team as a code owner August 26, 2026 08:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ce159bdf3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/browser-logs/src/domain/logger.ts Outdated
Comment thread packages/browser-logs/src/rawLogsEvent.types.ts
Extend debug id attachment to network error logs by exporting
getStackTraceUrls and reusing it in networkErrorCollection to derive
debug_ids from the computed stack trace.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 181.52 KiB 181.63 KiB +108 B +0.06%
Rum Profiler 8.43 KiB 8.43 KiB 0 B 0.00%
Rum Recorder 22.31 KiB 22.31 KiB 0 B 0.00%
Logs 57.63 KiB 57.93 KiB +312 B +0.53%
Rum Salesforce N/A 139.69 KiB N/A N/A N/A
Rum Slim 139.59 KiB 139.68 KiB +96 B +0.07%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 202.45 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.43 KiB N/A N/A N/A
Rum-shopify Recorder N/A 3.72 KiB N/A N/A N/A

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 26, 2026

Copy link
Copy Markdown

Tests

All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 25.00%
Overall Coverage: 77.11% (+0.15%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d9f9d08 | Docs | View more details | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a0b818459

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

message: logsMessage.message,
status: logsMessage.status,
origin: ErrorSource.LOGGER,
_dd: { debug_ids: logsMessage.debugIds },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Omit _dd when no debug IDs exist

issue: For every HTTP-handled logger call without resolved debug IDs—including ordinary DD_LOGS.logger.info('message') calls—this unconditionally adds _dd: { debug_ids: undefined }. Assembly preserves the wrapper, so beforeSend, bridge consumers, and serialized intake events receive an unexpected _dd: {}; the updated startLogs.spec.ts confirms this wire-shape regression. Construct _dd conditionally, as the network-error path does, so logs unrelated to debug IDs retain their previous callback and payload shape.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's fine

@amortemousque
amortemousque force-pushed the aymeric/debug-id-logs branch from 3a0b818 to d9f9d08 Compare August 26, 2026 09:45
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.

2 participants