-
Notifications
You must be signed in to change notification settings - Fork 251
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
V7: Rename autoCaptureSessions -> autoTrackSessions and simplify validation logic #647
Conversation
@@ -23,8 +23,8 @@ var bugsnagClient = bugsnag({ | |||
appVersion: '1.2.3', | |||
|
|||
// Bugsnag can track the number of “sessions” that happen in your application, | |||
// and calculate a crash rate for each release. This defaults to false. | |||
autoCaptureSessions: true, | |||
// and calculate a crash rate for each release. This defaults to true. |
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.
the default value has not been updated in this PR, this comment was out of date.
@@ -18,11 +18,6 @@ const sessionDelegate = { | |||
return sessionClient | |||
} | |||
|
|||
if (!sessionClient.config.endpoints.sessions) { |
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.
The config schema now validates that endpoints.sessions
must now be defined so this branch of code is obsolete.
@@ -37,11 +37,6 @@ const sendSessionSummary = client => sessionCounts => { | |||
return | |||
} | |||
|
|||
if (!client.config.endpoints.sessions) { |
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.
As above, commenting here too for an equivalent change… the config schema now validates that endpoints.sessions
must now be defined so this branch of code is obsolete.
@@ -8,7 +8,7 @@ | |||
var API_KEY = decodeURIComponent(window.location.search.match(/API_KEY=([^&]+)/)[1]) | |||
var bugsnagClient = bugsnag({ | |||
apiKey: API_KEY, | |||
endpoints: { notify: ENDPOINT }, | |||
endpoints: { notify: ENDPOINT, sessions: '/noop' }, |
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.
Loads of the end-to-end tests that relied on being allowed to not set a custom session endpoint now need some value to satisfy the config validation, but all of these tests only make assertions about errors.
I've set it to this value here (and many other places), which hopefully which suggests it's not used at all to appease the config validation.
… simplify validation logic Per the updated spec, the option to disable sessions is called `autoTrackSessions`. In addition to making that update, a suggestion made here¹ was incorporated to make the session endpoint always required (this only applies when endpoints is set). Previously the validation of the `autoCaptureSessions` field was dependent on whether a session endpoint was provided, which made the logic unnecessarily complex. ¹https://github.com/bugsnag/bugsnag-js/pull/630/files#r343663933
685c328
to
aa74d61
Compare
Per the updated spec, the option to disable sessions is called
autoTrackSessions
. In addition to making that update, a suggestion made here¹ was incorporated to make the session endpoint always required (this only applies when endpoints is set).Previously the validation of the
autoCaptureSessions
field was dependent on whether a session endpoint was provided, which made the logic unnecessarily complex.¹https://github.com/bugsnag/bugsnag-js/pull/630/files#r343663933