-
Notifications
You must be signed in to change notification settings - Fork 156
🔈 [RUM-10284] collect telemetry before starting the session manager #3602
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
Conversation
This is to be uniform with RUM
We don't really need to flush telemetry on session expiration. Let's break this requirement, it will allow us to start and send telemetry before starting the session manager.
This is needed to progressively set context and don't crash if context variables (ex: `session`) isn't defined yet when collecting telemetry.
5b7bde8
to
54b02ba
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3602 +/- ##
==========================================
+ Coverage 92.37% 92.44% +0.07%
==========================================
Files 323 322 -1
Lines 8132 8129 -3
Branches 1842 1840 -2
==========================================
+ Hits 7512 7515 +3
+ Misses 620 614 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
@@ -45,8 +50,8 @@ export const enum TelemetryService { | |||
} | |||
|
|||
export interface Telemetry { | |||
setContextProvider: (provider: () => Context) => void | |||
observable: Observable<TelemetryEvent & Context> | |||
setContextProvider: (key: string, contextProvider: () => ContextValue | undefined) => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: Using a new hook like assembleTelemetry
you could get rid of this setContextProvider
(No need to do it right now but just to keep in mind)
packages/rum-core/src/domain/startCustomerDataTelemetry.spec.ts
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
c0ec56e
to
6f805b9
Compare
6f805b9
to
6c68f88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
telemetry.setContextProvider(() => ({ | ||
foo: 'bar', | ||
})) | ||
telemetry.setContextProvider('foo', () => 'bar') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: what about adding a test to illustrate "the progressively set context" case?
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
|
Motivation
We observed that in some condition, the SessionManager crashes. While the exception is caught and buffered in-memory for telemetry, the telemetry event itself is not sent to Datadog.
The goal of this PR is to be able to cover more ground in our telemetry monitoring and caught exceptions that are coming from the Session Manager.
Changes
Changes are kind of significative, so bare with me. As always, please review commit by commit.
The overall strategy is first to refactor Telemetry code so both Logs and RUM behave the same. This implies using a separate batch for telemetry, which was not the case for RUM.
With telemetry logic refactored, we can do some modifications that allows to send telemetry earlier, without waiting for startLogs or startRum to finish.
Test instructions
Open the sandbox in Chrome
Using chrome devtools, edit the session cookie to add
&lock=1
at the end. This makes the Logs and RUM SDKs crash (specific changes for this crash will come in later PRs).Refresh the page
Check that telemetry errors are listed in the devtools extension.
Also, check that those telemetry errors are sent to Datadog intake in the Network tab.
Checklist