Skip to content

Conversation

@AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented May 28, 2021

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:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@AbhiPrasad AbhiPrasad requested a review from rhcarvalho May 28, 2021 18:26
@AbhiPrasad AbhiPrasad requested a review from kamilogorek as a code owner May 28, 2021 18:26
@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.83 KB (+0.28% 🔺)
@sentry/browser - Webpack 22.07 KB (+0.35% 🔺)
@sentry/react - Webpack 22.11 KB (+0.35% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.23 KB (+0.2% 🔺)

Copy link
Contributor

@rhcarvalho rhcarvalho left a 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.

@AbhiPrasad
Copy link
Member Author

Thanks for your detailed review @rhcarvalho, I'm converting back to draft since I think there's a better way to accomplish this.

@AbhiPrasad AbhiPrasad marked this pull request as draft May 28, 2021 19:02
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.
@AbhiPrasad AbhiPrasad force-pushed the abhi/session-duration-fix branch 3 times, most recently from 97d9395 to 2fbd61e Compare May 31, 2021 14:18
@AbhiPrasad AbhiPrasad force-pushed the abhi/session-duration-fix branch from 2fbd61e to a4857c9 Compare May 31, 2021 14:19
@AbhiPrasad AbhiPrasad marked this pull request as ready for review May 31, 2021 18:14
@AbhiPrasad AbhiPrasad requested a review from rhcarvalho May 31, 2021 18:14
Copy link
Contributor

@rhcarvalho rhcarvalho left a 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.

@AbhiPrasad AbhiPrasad force-pushed the abhi/session-duration-fix branch from 0619ed2 to 96da8f5 Compare June 1, 2021 12:10
* 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
@AbhiPrasad AbhiPrasad force-pushed the abhi/session-duration-fix branch from 96da8f5 to 9ba5968 Compare June 1, 2021 12:12
@AbhiPrasad AbhiPrasad enabled auto-merge (squash) June 1, 2021 12:16
@AbhiPrasad AbhiPrasad merged commit d712e13 into master Jun 1, 2021
@AbhiPrasad AbhiPrasad deleted the abhi/session-duration-fix branch June 1, 2021 12:21
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.

Session duration should be reported in seconds

3 participants