Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [RUM-4013] DD_RUM: add handling stack in beforeSend context #2730

Merged
merged 15 commits into from
May 30, 2024

Conversation

thomas-lebeau
Copy link
Collaborator

@thomas-lebeau thomas-lebeau commented Apr 26, 2024

Motivation

Create a stack trace and expose it in the beforeSend's domainContext argument.
It allow customers to initialise the browser SDK with something like:

const SERVICE_REGEX = /(?:browser-sdk-test-playground\/module-federation\/|webpack:\/\/)(?<service>\w*)\//;
  
DD_RUM.init({
  beforeSend: (event, context) => {
    const service =
      context?.handlingStack?.match(SERVICE_REGEX)?.groups?.service;

    if (service) {
      event.service = service; //TODO: this is not yet implemented
    }
    return true;
  },
});

Changes

support the following APIs

  • DD_RUM.addError()
  • DD_RUM.addAction()
  • fetch() resources
  • xhr resources
  • console errors

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.59%. Comparing base (f551f53) to head (8c095c2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2730      +/-   ##
==========================================
+ Coverage   93.58%   93.59%   +0.01%     
==========================================
  Files         243      243              
  Lines        7043     7057      +14     
  Branches     1555     1563       +8     
==========================================
+ Hits         6591     6605      +14     
  Misses        452      452              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cit-pr-commenter bot commented Apr 26, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 157.18 KiB 157.68 KiB 510 B +0.32%
Logs 56.42 KiB 56.60 KiB 181 B +0.31%
Rum Slim 103.74 KiB 104.24 KiB 510 B +0.48%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.001 0.002 0.000
addaction 0.015 0.032 0.017
adderror 0.031 0.032 0.002
addtiming 0.001 0.001 0.000
startview 0.812 0.858 0.047
startstopsessionreplayrecording 0.731 0.806 0.076
logmessage 0.005 0.006 0.001
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫
addglobalcontext NaN KiB 26.36 KiB NaN KiB
addaction NaN KiB 56.28 KiB NaN KiB
adderror NaN KiB 56.13 KiB NaN KiB
addtiming NaN KiB 8.68 KiB NaN KiB
startview NaN KiB 1911.36 KiB NaN KiB
startstopsessionreplayrecording NaN KiB 11.23 KiB NaN KiB
logmessage NaN KiB 68.82 KiB NaN KiB

@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/micro-frontend-rum branch from 73ea395 to 60046eb Compare April 30, 2024 13:04
@thomas-lebeau thomas-lebeau marked this pull request as ready for review May 23, 2024 11:51
@thomas-lebeau thomas-lebeau requested a review from a team as a code owner May 23, 2024 11:51
@thomas-lebeau thomas-lebeau marked this pull request as draft May 23, 2024 11:51
@thomas-lebeau thomas-lebeau marked this pull request as ready for review May 23, 2024 12:20
@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/micro-frontend-rum branch from 93301aa to 8a3328f Compare May 27, 2024 09:38
@thomas-lebeau thomas-lebeau changed the title ✨ [RUM-4013] add handling stack in beforeSend context ✨ [RUM-4013] DD_RUM: add handling stack in beforeSend context May 28, 2024
@thomas-lebeau thomas-lebeau merged commit 717506e into main May 30, 2024
20 checks passed
@thomas-lebeau thomas-lebeau deleted the thomas.lebeau/micro-frontend-rum branch May 30, 2024 08:29
thomas-lebeau added a commit that referenced this pull request May 30, 2024
…into staging-22

 pm_trace_id: 35435314
 feature_branch_pipeline_id: 35435314
 source: to-staging

* commit 'ddcbddb507cfa0bd412938a9e5c0ad8b03ab8685':
  ✨ [RUM-4013] DD_RUM: add handling stack in beforeSend context (#2730)
thomas-lebeau added a commit that referenced this pull request May 30, 2024
* ✨ [RUM-4013] add handling stack in beforeSend context

* add handling stack for addErrors and addAction

* 🧪 add e2e tests

* add e2e and loose up unit tests

* remove unused variable

* 🧪 add missing test coverage

* ✅ add e2e test for console errors

* fix missing imports

* remove unused imports

* 👌 add type to e2e tests

* 👌 fix pr comments
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.

4 participants