Bugsnag tracks the number of “sessions” that happen within your application. This allows you to compare stability scores between releases and helps you to understand the quality of your releases.
Bugsnag does not track sessions automatically in standalone Ruby applications.
You should call these methods at the appropriate time in your application’s lifecycle when you wish to have an active session. Any errors which occur in your application outside of a session will still be reported to Bugsnag but will not count towards your application’s stability score.
Starts a new session to which subsequent handled and unhandled events will be attributed to.
If there is already an active session, it will be replaced with a new one. Use
resume_session if you only want to start a session when one doesn’t already exist.
Prevents further events being attributed to the current session until the session is resumed or a new session is started.
This can be advantageous if, for example, you do not wish the stability score to include crashes in a background service.
Resumes tracking events against the current session, if it was previously paused. If there is was no previous session, a new session is started. This method returns
true if there was a session to resume and returns
false if a new session was created or the current session was not paused.
if Bugsnag.resume_session # a paused session has been resumed else # a new session was created or the current session was not paused end
Information about the current session is available on the
current_session = Bugsnag::SessionTracker.get_current_session if current_session.nil? # no session has been started else puts current_session end
The current session is a Hash containing the following data:
||String||A UUID for the session|
||String||The time that the session was started|
||Boolean||Whether the session is currently paused|
||Hash||A hash containing the number of handled and unhandled events attributed to this session. These are stored under the