Skip to content

[RUM-20337] feat: Add Vega logging and user/account context - #1579

Open
cdn34dd wants to merge 4 commits into
carlosnogueira/RUM-20336/add-vega-rum-and-global-attributesfrom
carlosnogueira/RUM-20337/add-vega-logging-and-user-account-context
Open

cdn34dd wants to merge 4 commits into
carlosnogueira/RUM-20336/add-vega-rum-and-global-attributesfrom
carlosnogueira/RUM-20337/add-vega-logging-and-user-account-context

Conversation

@cdn34dd

@cdn34dd cdn34dd commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds debug, info, warn, and error logging to the Vega package, including error details and custom attributes. Adds APIs to set, update, and clear user and account information.

Global attributes now reach both RUM and logging, including logging-only configurations. JavaScript user/account context updates only after native accepts the change.

Motivation

Vega apps need logs and user/account context to help explain what happened during a session. This adds the APIs covered by RUM-20337 on top of the RUM support in RUM-20336.

Additional Notes

  • Repeated setup keeps the working logger. The private Vega build compiles an SDK 0.7.0 source copy with nullable registration failures, so failed setup leaves logging disabled. The dependency checkout is unchanged.
  • addUserExtraInfo supports anonymous users, matching core. Account extra information still requires an account to be set.
  • Stacked on RUM-20336.
  • Adds native logger configuration with RUM correlation controlled by bundleLogsWithRum. The initializer in RUM-20335 must call this helper when logging is configured.
  • Includes regenerated Kepler bindings and tests for log arguments, bridge failures, context updates, and app-owned objects changed while a native call is pending.
  • The README documents the C++ SDK's log source and fingerprint limitations. Error symbolication and automatic JavaScript error reporting remain separate work.
  • Validation passed: yarn test --runInBand --watchman=false (1,997 tests; one skipped), yarn lint (no errors; 12 existing warnings), and yarn prepare.
  • Three native host tests passed, including real SDK logging registration and attribute acceptance. The combined native library compiled and linked for aarch64, armv7, and x86_64. Device smoke testing has not been run.
  • The incremental change totals 1,104 added/removed lines. The SDK compatibility fix and native regression coverage take this above the usual 1,000-line target.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@cdn34dd
cdn34dd added this pull request to stack #1580 November 24, 2026 17:44

@cursor cursor 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.

PR Review — Quality: 3.0 / 5 · Review load: Broad (~1–2h)

This adds Vega log forwarding, user and account context, and global attributes on both RUM and logging. The JavaScript paths match the tests, but it should not merge until configureLogging stops treating a failed Logging::Register as a live logger. Also decide whether addUserExtraInfo without a user id should follow the core contract.

Customer impact: Low — new log, user, and account APIs on the private Vega package. They stay inactive until a later initializer stores a core and calls configureLogging. Once that lands, Vega apps that call these APIs send logs and identity, and global attributes are copied onto logging as well as RUM.

Concern
Logging API, native logger, and RUM correlation Risky
User and account context synchronization Risky
Global attributes applied to RUM and logging Risky

Assessment: Log argument splitting, fingerprint attributes, and "update the JavaScript singleton only after native accepts" match the new Jest tests and callNative. Those tests mock the TurboModule, so they do not show what dd-sdk-cpp 0.7.0 does when Logging::Register fails. On the documented path (one call, core already Initialized, before Start) registration succeeds and logs can be emitted. A failed or repeated call stores a non-null no-op, and later logs and logging-only attributes still report success. addUserExtraInfo without a user id is dropped, which core does not do; the account guard matches core. Conventions match the existing Vega bridge: license headers, promise failures resolve false, and the generated DdLogs spec matches NativeDdLogs.ts. Quality stays below 5.0 because of the registration failure path and the undocumented user-extra-info difference.

Review load — Broad (~1–2h): The logger lifetime, the user/account singleton update, and attribute fan-out can fail separately, but they live in one Vega bridge and can be reviewed together.

Findings

  • [Minor · Correctness] Failed logger registration is stored as success — configureLogging publishes dd-sdk-cpp's non-null no-op, so a failed or second registration drops later logs while the bridge resolves success. Inline comment on LoggingConfiguration.cpp.
  • [Minor · Scope] Anonymous user extra info is dropped — Vega returns before addUserExtraInfo when no user is set. Core forwards that call. Inline comment on DdSdkReactNativeVega.ts.
Open in Web View Automation 

Sent by Cursor Automation: dd-sdk-react-native reviews

@cdn34dd
cdn34dd force-pushed the carlosnogueira/RUM-20337/add-vega-logging-and-user-account-context branch from f4db644 to b45e29d Compare November 25, 2026 10:40

@cursor cursor 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.

PR Review — Quality: 5.0 / 5 · Review load: Broad (~1–2h)

Ready to merge as-is. Failed logger registration stays disabled, and addUserExtraInfo without a user id follows core. Quality moved from 3.0 because those two defects are fixed: registration and anonymous user attributes.

Customer impact: Low — new log, user, and account APIs on the private Vega package. They stay inactive until a later initializer stores a core and calls configureLogging. Once that lands, Vega apps that call these APIs send logs and identity, and global attributes are copied onto logging as well as RUM.

Concern
Logging registration, SDK compatibility patch, and RUM correlation Risky
User and account context synchronization Risky
Global attributes applied to RUM and logging Risky

Assessment: In dd-sdk-cpp 0.7.0, Logging::Register uses two single-argument make_shared<Logging>(PrivateCtorTag{}) returns for failure (!core->_impl, and RegisterFeature false when the core is not initialized, already started, or logging is already registered). The compatibility CMake copies logging.cpp and rewrites those two returns to nullptr. The success return is a different expression, so a successful registration is still published. configureLogging returns when a logger is already stored and does not call setLogging / setLogger after a null registration, so DdLogs resolves false and logging-only attributes are rejected. The new Jest cases send addUserExtraInfo with no user id, merge into UserInfoSingleton only after native accepts, and keep the account guard. LoggingConfigurationTest covers a failed registration, a repeat call, and logging-only attributes; it stays opt-in because it builds the SDK, same as the existing host attribute tests. The README states the nullable copy, anonymous user attributes, and the account requirement.

Review load — Broad (~1–2h): Logger lifetime, user/account updates, and attribute fan-out can fail separately, but they live in one Vega bridge and can be reviewed together.

This run reviewed the delta since f4db644d and revalidated the earlier findings.

Open in Web View Automation 

Sent by Cursor Automation: dd-sdk-react-native reviews

@cdn34dd
cdn34dd marked this pull request as ready for review November 25, 2026 10:56
@cdn34dd
cdn34dd requested review from a team as code owners November 25, 2026 10:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T10:58:01.426098Z b45e29d Draft marked ready
🔒 Security Review ✅ Completed 2026-11-25T10:59:50.324207Z b45e29d 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.

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 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.

Bits Code Review: FAIL

Caller-owned attribute mutations during pending native calls can leave JavaScript user/account context different from the values native accepted. The mismatch was reproduced for all four new context-setting and merging methods.

Open Bits AI session

🤖 Bits Code Review · Commit b45e29d

native.addUserExtraInfo(info)
)
) {
UserInfoSingleton.getInstance().addUserExtraInfo(info);

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 Snapshot custom context before awaiting the native bridge

If application code mutates info while addUserExtraInfo awaits native, the singleton commits the mutated values rather than those submitted. Executing the actual wrapper and singleton sources with a deferred, argument-snapshotting native stub reproduced native receiving { count: 1 } while JavaScript stored { count: 2 }. addAccountExtraInfo has the same problem, and both setters retain mutable nested extraInfo through shallow copies. Capture independent attribute snapshots before invoking native and commit those same snapshots across all four methods.

React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it

What each reaction means
  • 👍 Useful: correct, and you're fixing it or will.
  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
  • 😕 Unclear: you can't tell what it means or why it matters.
  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

🤖 Bits Code Review · Open Bits AI session

@buraizu buraizu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR, just requested some inline doc edits and posted a question about page structure

Comment on lines +79 to +81
`DdLogs` forwards debug, info, warn and error logs, with optional error kind,
message, stack and attributes. `DdSdkReactNative` supports setting, updating and
clearing user/account information. Native failures leave JavaScript context

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
`DdLogs` forwards debug, info, warn and error logs, with optional error kind,
message, stack and attributes. `DdSdkReactNative` supports setting, updating and
clearing user/account information. Native failures leave JavaScript context
`DdLogs` forwards debug, info, warn, and error logs, with optional error kind,
message, stack, and attributes. `DdSdkReactNative` supports setting, updating,
and clearing user and account information. Native failures leave JavaScript context

Comment on lines +86 to +87
`bundleLogsWithRum` to control RUM correlation (defaults to `true`). Initialization
is added separately; importing these APIs does not initialize the SDK. Logs are

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
`bundleLogsWithRum` to control RUM correlation (defaults to `true`). Initialization
is added separately; importing these APIs does not initialize the SDK. Logs are
`bundleLogsWithRum` to control RUM correlation (defaults to `true`). This package
does not initialize the SDK, and importing these APIs does not initialize it. Logs are

Comment on lines +109 to +110
logging-only attributes. This uses the same compatibility source as Vega builds
and requires the SDK and include paths described above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
logging-only attributes. This uses the same compatibility source as Vega builds
and requires the SDK and include paths described above.
logging-only attributes. The test uses the same compatibility source as Vega builds
and requires `DATADOG_CPP_SOURCE_DIR`, `KEPLER_INCLUDE_DIR`, and `NODE_API_INCLUDE_DIR`.

building on macOS. The default host test command still runs the transport tests
without these SDK dependencies.

`DdLogs` forwards debug, info, warn and error logs, with optional error kind,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just flagging that these new paragraphs are added at the end of the ### C++ SDK 0.7.0 limitations section. Could you confirm if that's the expected location? If not, suggesting to add an H2 heading such as ## Logs and user and account context before the DdLogs paragraph, matching the existing ## Manual RUM and global attributes heading, so the logging content and its compatibility subsection get their own section.

This branch has not been deployed

No deployments
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