-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(sessions): Correctly compute session duration #3616
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
size-limit report
|
rhcarvalho
left a comment
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.
@AbhiPrasad thanks for taking a crack at this and shipping quick! We're definitely missing tests here to cover 1) the original bug 2) the undesired changes in types for the wire format.
|
Thanks for your detailed review @rhcarvalho, I'm converting back to draft since I think there's a better way to accomplish this. |
Closes #3615 * Update the @sentry/browser client to not send durations when capturing sessions. * Leverage timestampInSeconds from @sentry/utils instead of Date.now() to make sure that durations are correctly reported to Sentry.
Previously in c9b3d10, the duration was updated to be undefined when the browser SDK sent sessions to Sentry. This patch removes that logic and instead adds a browser flag to the Session class, which indicates if a duration should be included or not.
97d9395 to
2fbd61e
Compare
2fbd61e to
a4857c9
Compare
rhcarvalho
left a comment
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.
I think this should indeed fix the problems we found. Thanks @AbhiPrasad.
A few optional suggestions.
0619ed2 to
96da8f5
Compare
* ref: Switch from isBrowser -> ignoreDuration * test: Add sanity check test for sec to ms conversion * ref: Update session.close tests to assert on session instead of spying on implementation
96da8f5 to
9ba5968
Compare
Closes #3615
Update the @sentry/hub session to not send durations in browser env. A
flag is used to indicate if a session is in a browser environment.
Leverage timestampInSeconds from @sentry/utils instead of Date.now()
to make sure that durations are correctly reported to Sentry.
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).