Repository navigation
[RUM-20337] feat: Add Vega logging and user/account context - #1579
Conversation
There was a problem hiding this comment.
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 —
configureLoggingpublishes dd-sdk-cpp's non-null no-op, so a failed or second registration drops later logs while the bridge resolves success. Inline comment onLoggingConfiguration.cpp. - [Minor · Scope] Anonymous user extra info is dropped — Vega returns before
addUserExtraInfowhen no user is set. Core forwards that call. Inline comment onDdSdkReactNativeVega.ts.
Sent by Cursor Automation: dd-sdk-react-native reviews
f4db644 to
b45e29d
Compare
There was a problem hiding this comment.
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.
Sent by Cursor Automation: dd-sdk-react-native reviews
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
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.
🤖 Bits Code Review · Commit b45e29d
| native.addUserExtraInfo(info) | ||
| ) | ||
| ) { | ||
| UserInfoSingleton.getInstance().addUserExtraInfo(info); |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Thanks for the PR, just requested some inline doc edits and posted a question about page structure
| `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 |
There was a problem hiding this comment.
| `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 |
| `bundleLogsWithRum` to control RUM correlation (defaults to `true`). Initialization | ||
| is added separately; importing these APIs does not initialize the SDK. Logs are |
There was a problem hiding this comment.
| `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 |
| logging-only attributes. This uses the same compatibility source as Vega builds | ||
| and requires the SDK and include paths described above. |
There was a problem hiding this comment.
| 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, |
There was a problem hiding this comment.
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.


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
addUserExtraInfosupports anonymous users, matching core. Account extra information still requires an account to be set.bundleLogsWithRum. The initializer in RUM-20335 must call this helper when logging is configured.yarn test --runInBand --watchman=false(1,997 tests; one skipped),yarn lint(no errors; 12 existing warnings), andyarn prepare.Review checklist (to be filled by reviewers)