Skip to content

♻️ Merge message context into raw logs event at collection time - #5009

Open
BenoitZugmeyer wants to merge 1 commit into
mainfrom
benoit/merge-message-context
Open

♻️ Merge message context into raw logs event at collection time#5009
BenoitZugmeyer wants to merge 1 commit into
mainfrom
benoit/merge-message-context

Conversation

@BenoitZugmeyer

@BenoitZugmeyer BenoitZugmeyer commented Sep 3, 2026

Copy link
Copy Markdown
Member

Motivation

This is a small refactor that will simplify #4920

Logs collection carried the user-provided message context as a separate messageContext field through the lifecycle, only to merge it into the event during assembly. This indirection added complexity to the data flow for no benefit, since the context is always meant to end up on the log event itself.

Changes

  • Merge messageContext directly into rawLogsEvent at collection time (console, logger, and runtime error sources) using combine, preserving the existing precedence (message context overrides base event fields).
  • Remove the messageContext field from RawLogsEventCollectedData.
  • Add an index signature to CommonRawLogsEvent so user context fields are accepted by the type system.
  • Update affected specs and add a test asserting message context precedence over native raw log fields.

Test instructions

  • In the sandbox, send a log with extra context (e.g. DD_LOGS.logger.log('hello', { foo: 'bar' })) and confirm the context fields appear on the sent log event.
  • Verify that passing a context key that collides with a native field (e.g. message) overrides the native value in the sent event.

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

The messageContext field was carried separately through the logs lifecycle and merged into the event during assembly. Merge it directly into rawLogsEvent at collection time instead, simplifying the data flow and removing the dedicated field on RawLogsEventCollectedData.
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 182.00 KiB 182.00 KiB 0 B 0.00%
Rum Profiler 8.43 KiB 8.43 KiB 0 B 0.00%
Rum Recorder 25.32 KiB 25.32 KiB 0 B 0.00%
Logs 57.93 KiB 57.88 KiB -52 B -0.09%
Rum Salesforce N/A 140.05 KiB N/A N/A N/A
Rum Slim 140.05 KiB 140.05 KiB 0 B 0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 206.79 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.74 KiB N/A N/A N/A

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Sep 3, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 77.01% (+0.00%)

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

@BenoitZugmeyer
BenoitZugmeyer marked this pull request as ready for review September 4, 2026 08:05
@BenoitZugmeyer
BenoitZugmeyer requested a review from a team as a code owner September 4, 2026 08:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T08:09:27.033904Z fdfea55 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: fdfea55f77

ℹ️ 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/loggerCollection.ts
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.

1 participant