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

✨ [RUMF-1084] ignore init if a RUM instance is or will be injected by synthetics #1170

Merged
merged 9 commits into from
Nov 22, 2021

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

Allows the Synthetics worker to prevent any RUM SDK initialisation if it plans to inject a RUM instance itself.

Changes

  • Move synthetics context in its own module
  • Ignore init() call based on values (global variables/cookies) provided by the Synthetics worker

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner November 16, 2021 17:03
@@ -0,0 +1,30 @@
import { getCookie } from '@datadog/browser-core'
Copy link
Contributor

Choose a reason for hiding this comment

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

tools/syntheticsContext.ts, should it be consider as a tool?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you rather put it in domain? I thought it wasn't directly related to how RUM works, but happy to move it elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not to have tools, but I would also think of moving other components like ContextHistory which also looks like tools.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO

  • syntheticsContext -> domain
  • contextHistory -> tools

To avoid any side effect like warning message, let's bail out earlier.
@codecov-commenter
Copy link

Codecov Report

Merging #1170 (af7c645) into main (9583f46) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1170      +/-   ##
==========================================
+ Coverage   88.69%   88.71%   +0.01%     
==========================================
  Files          97       98       +1     
  Lines        4264     4270       +6     
  Branches      962      964       +2     
==========================================
+ Hits         3782     3788       +6     
  Misses        482      482              
Impacted Files Coverage Δ
packages/rum-core/src/domain/assembly.ts 100.00% <ø> (ø)
packages/rum-core/src/domain/parentContexts.ts 100.00% <ø> (ø)
packages/rum-core/src/domain/urlContexts.ts 100.00% <ø> (ø)
packages/rum-core/src/tools/contextHistory.ts 100.00% <ø> (ø)
packages/rum-core/src/boot/rumPublicApi.ts 93.69% <100.00%> (+0.11%) ⬆️
packages/rum-core/src/domain/syntheticsContext.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9583f46...af7c645. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer merged commit 0abacc5 into main Nov 22, 2021
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/ignore-init-if-synthetics-injected branch November 22, 2021 09:56
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