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-2445] split RUM and Logs public APIs modules #2575

Merged
merged 10 commits into from
Feb 1, 2024

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Jan 17, 2024

Motivation

The rumPublicApi and logsPublicApi modules are a bit large. As we want to add more logic before starting RUM and Logs for consent management, it is a good time to extract the "pre start" logic (code executed before actually starting RUM or Logs) to separate modules.

Changes

In both RUM and Logs public APIs, introduce a Strategy interface for behaviors that differs before and after starting the SDK. The Strategy replaces the various xxxStrategy functions, and is created by a dedicated createPreStartStrategy function. The "post start" strategy is returned by startRum and startLogs functions, as before.

In the RUM case, the trackViewManually logic has been revamped a little bit to make it a bit more explicit (the first startView call can be ignored and its related View options can be retrieved when starting RUM)

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/consent--simplify-public-apis-2 branch from 83bb638 to b8a9a4e Compare January 17, 2024 15:37
@BenoitZugmeyer
Copy link
Member Author

/to-staging

@dd-devflow
Copy link

dd-devflow bot commented Jan 17, 2024

🚂 Branch Integration: starting soon, merge in < 0s

Commit b8a9a4ec84 will soon be integrated into staging-03.

This build is going to start soon! (estimated merge in less than 0s)

Use /to-staging -c to cancel this operation.!

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (c238972) 92.82% compared to head (ac3d77b) 92.77%.

Files Patch % Lines
packages/rum-core/src/boot/rumPublicApi.ts 89.28% 3 Missing ⚠️
packages/logs/src/boot/logsPublicApi.ts 90.00% 2 Missing ⚠️
packages/logs/src/boot/preStartLogs.ts 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2575      +/-   ##
==========================================
- Coverage   92.82%   92.77%   -0.06%     
==========================================
  Files         232      235       +3     
  Lines        6760     6781      +21     
  Branches     1486     1484       -2     
==========================================
+ Hits         6275     6291      +16     
- Misses        485      490       +5     

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

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review January 17, 2024 15:45
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner January 17, 2024 15:45
dd-mergequeue bot added a commit that referenced this pull request Jan 17, 2024
@dd-devflow
Copy link

dd-devflow bot commented Jan 17, 2024

🚂 Branch Integration: This commit was successfully integrated

Commit b8a9a4ec84 has been merged into staging-03 in merge commit f9bed34ac9.

Check out the triggered pipeline on Gitlab 🦊

packages/logs/src/boot/logsPublicApi.ts Outdated Show resolved Hide resolved
function createPostStartStrategy(initConfiguration: RumInitConfiguration, startRumResult: StartRumResult): Strategy {
return assign(
{
init: (initConfiguration: RumInitConfiguration) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ question: Can we avoid to redefined the init function on the post strategy knowing that the one in the preStart already handles multiples init?

Copy link
Member Author

Choose a reason for hiding this comment

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

For the record: I tried to make some changes, but after a review and discussions with Aymeric we were not quite satisfied with the tradeoffs. It seems to be better to keep "pre start" and "post start" strategies strictly separated.

packages/rum-core/src/boot/preStartRum.ts Outdated Show resolved Hide resolved
packages/rum-core/src/boot/preStartRum.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/logsPublicApi.ts Outdated Show resolved Hide resolved
@BenoitZugmeyer
Copy link
Member Author

/to-staging

@dd-devflow
Copy link

dd-devflow bot commented Jan 30, 2024

🚂 Branch Integration: starting soon, merge in < 9m

Commit 0300c627a9 will soon be integrated into staging-05.

This build is going to start soon! (estimated merge in less than 9m)

Use /to-staging -c to cancel this operation!

dd-mergequeue bot added a commit that referenced this pull request Jan 30, 2024
@dd-devflow
Copy link

dd-devflow bot commented Jan 30, 2024

🚂 Branch Integration: This commit was successfully integrated

Commit 0300c627a9 has been merged into staging-05 in merge commit 46d8052c2a.

Check out the triggered pipeline on Gitlab 🦊

packages/rum-core/src/boot/preStartRum.ts Outdated Show resolved Hide resolved
packages/core/src/tools/boundedBuffer.ts Outdated Show resolved Hide resolved
packages/rum-core/src/boot/preStartRum.ts Outdated Show resolved Hide resolved
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner February 1, 2024 09:28
@BenoitZugmeyer BenoitZugmeyer merged commit d1b8e72 into main Feb 1, 2024
17 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/consent--simplify-public-apis-2 branch February 1, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants