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-1176] collect other console logs new #1316

Merged
merged 30 commits into from
Feb 16, 2022

Conversation

amortemousque
Copy link
Contributor

@amortemousque amortemousque commented Feb 4, 2022

Motivation

Collect all console logs.
Under feature flag

Changes

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque requested a review from a team as a code owner February 4, 2022 15:06
@amortemousque amortemousque marked this pull request as draft February 4, 2022 15:07
@amortemousque amortemousque force-pushed the aymeric/collect-other-console-logs-new branch from cfe3837 to 3ef80e6 Compare February 4, 2022 15:14
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
packages/core/src/tools/observable.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/startLogs.ts Outdated Show resolved Hide resolved
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 7, 2022

Codecov Report

Merging #1316 (109ce1f) into main (9b48504) will increase coverage by 0.06%.
The diff coverage is 92.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1316      +/-   ##
==========================================
+ Coverage   90.96%   91.03%   +0.06%     
==========================================
  Files         105      106       +1     
  Lines        4238     4281      +43     
  Branches      946      953       +7     
==========================================
+ Hits         3855     3897      +42     
- Misses        383      384       +1     
Impacted Files Coverage Δ
...omain/rumEventsCollection/error/errorCollection.ts 76.00% <ø> (ø)
...ain/rumEventsCollection/error/trackConsoleError.ts 66.66% <66.66%> (ø)
packages/logs/src/boot/startLogs.ts 90.38% <80.95%> (+3.71%) ⬆️
...kages/core/src/domain/console/consoleObservable.ts 100.00% <100.00%> (ø)
packages/core/src/tools/observable.ts 100.00% <100.00%> (ø)
packages/core/src/tools/utils.ts 86.48% <100.00%> (+0.37%) ⬆️
packages/logs/src/domain/configuration.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 9b48504...109ce1f. Read the comment docs.

Copy link
Member

@BenoitZugmeyer BenoitZugmeyer left a comment

Choose a reason for hiding this comment

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

Appart from typechecking issue, LGTM!

@amortemousque amortemousque marked this pull request as ready for review February 8, 2022 15:57
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
packages/core/src/browser/consoleObservable.ts Outdated Show resolved Hide resolved
handlingStack?: string
}

const consoleObservables: { [k in ConsoleApiName]?: Observable<ConsoleLog> } = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 suggestion: ‏Can you add a test for the need to have a singleton?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't the "should allow multiple caller" test enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 removing the singleton does not fail the test, so something is not right

Copy link
Contributor Author

@amortemousque amortemousque Feb 9, 2022

Choose a reason for hiding this comment

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

It's because the observable references of consoleObservablesByApi live inside the merged observable.
I've updated the test to ensure the console api as been instrumented only once.

expect(instrumentedConsoleApi).toEqual(console[api])

packages/core/src/tools/utils.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/configuration.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/configuration.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/startLogs.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/startLogs.ts Show resolved Hide resolved
@amortemousque amortemousque force-pushed the aymeric/collect-other-console-logs-new branch from 4fb75c9 to 197dadc Compare February 9, 2022 13:35
packages/core/src/tools/observable.spec.ts Outdated Show resolved Hide resolved
packages/logs/src/boot/startLogs.ts Outdated Show resolved Hide resolved
packages/logs/src/domain/configuration.ts Outdated Show resolved Hide resolved
@@ -83,6 +93,7 @@ describe('logs', () => {
delete window.DD_RUM
resetExperimentalFeatures()
deleteEventBridgeStub()
stopSessionManager()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove test flackyness introduced with originalStartLogs in startLogs.spec.ts

@amortemousque amortemousque merged commit 78c8390 into main Feb 16, 2022
@amortemousque amortemousque deleted the aymeric/collect-other-console-logs-new branch February 16, 2022 08:17
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