Skip to content

[RUM 9145] Refactor RUM Action Tracking#941

Merged
cdn34dd merged 13 commits into
developfrom
carlosnogueira/RUM-9145/refactor-rum-action-tracking
Jul 31, 2025
Merged

[RUM 9145] Refactor RUM Action Tracking#941
cdn34dd merged 13 commits into
developfrom
carlosnogueira/RUM-9145/refactor-rum-action-tracking

Conversation

@cdn34dd

@cdn34dd cdn34dd commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Introduces a new method for automatic RUM action tracking using a Babel plugin. This plugin scans the user’s codebase for specific actions and wraps them with our custom logic.

This serves as a direct replacement for our current approach, which relies on wrapping React internals. That legacy method is no longer compatible with the latest versions of Expo.

The new system supports a dual-mode setup: if the Babel plugin is not included, the existing approach remains active. However, once the plugin is added, it takes full precedence and the legacy method is disabled. This setup allows users to adopt the new system gradually and gives us the opportunity to evaluate it performs before deprecating the original implementation.

Motivation

Provide a reliable and consistent way to automatically track RUM actions across all types of React Native applications—whether built with Expo or React Native CLI. The goal is to ensure compatibility across all versions of React Native and maintain consistent behavior regardless of whether the app uses the New Architecture or the Old Architecture.

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 requested a review from a team as a code owner July 18, 2025 15:49

@marco-saia-datadog marco-saia-datadog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Top-notch work! 👏

I would wait for the final round of testing before merging. As an alternative we could set "private": true in package.json until we're confident rolling it out.

WDYT?

@marco-saia-datadog marco-saia-datadog self-requested a review July 21, 2025 09:11

@marco-saia-datadog marco-saia-datadog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I forgot to mention it before, but we should add a README.md with a description of the new package and setup instructions.

@cdn34dd cdn34dd force-pushed the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch from c74fc3a to 588c663 Compare July 23, 2025 14:08
@cdn34dd cdn34dd requested a review from a team as a code owner July 23, 2025 15:06

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

Requesting some minor edits. In addition to these, could you please add the following line at the end of the doc, after the last code example (with a blank line between the code example and the link)?

[1]: https://www.npmjs.com/package/@datadog/mobile-react-native

This makes translation of the doc easier, as mentioned in our style guide

Comment thread packages/react-native-babel-plugin/README.md Outdated
Comment thread packages/react-native-babel-plugin/README.md Outdated
Comment thread packages/react-native-babel-plugin/README.md Outdated
Comment thread packages/react-native-babel-plugin/README.md Outdated
@cdn34dd cdn34dd force-pushed the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch from 7699285 to 8f01b30 Compare July 24, 2025 08:37
Comment thread packages/core/src/rum/constants.ts
Comment thread packages/react-native-babel-plugin/README.md Outdated
Comment thread packages/react-native-babel-plugin/README.md
Comment thread packages/react-native-babel-plugin/README.md
@marco-saia-datadog marco-saia-datadog self-requested a review July 24, 2025 10:06

@marco-saia-datadog marco-saia-datadog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMPORTANT

Testing on iOS old architecture (RN 0.65) I have encountered a critical runtime error because of sendTelemetryLog being undefined.

The reason is the missing RCT macro on DdSdk.mm.

You should add this:

RCT_REMAP_METHOD(sendTelemetryLog, withMessage:(NSString*)message
                 withAttributes: (NSDictionary *)attributes
                 withConfig:(NSDictionary *)config
                 withResolver:(RCTPromiseResolveBlock)resolve
                 withRejecter:(RCTPromiseRejectBlock)reject)
{
    [self sendTelemetryLog:message attributes:attributes config:config resolve:resolve reject:reject];
}

@cdn34dd cdn34dd force-pushed the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch from 8f01b30 to 657f59f Compare July 25, 2025 21:47
@cdn34dd cdn34dd force-pushed the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch from 657f59f to ed7c9f4 Compare July 31, 2025 11:34
@cdn34dd cdn34dd force-pushed the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch from ed7c9f4 to fa95a01 Compare July 31, 2025 13:33
@cdn34dd cdn34dd merged commit a6dc383 into develop Jul 31, 2025
10 checks passed
@cdn34dd cdn34dd deleted the carlosnogueira/RUM-9145/refactor-rum-action-tracking branch July 31, 2025 15:01
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.

3 participants