Skip to content

Make page the default browser session lifecycle mode #21241

@Lms24

Description

@Lms24

Problem Statement

Currently, browserSessionIntegration has two lifecycle modes:

  • route (default): Starts a new session on every route change by listening to the history API
  • page starts a new session on every pageload that persists across soft navigation/route changes.

route was always the default but it doesn't align well with how users reason about sessions (way too short).

Solution Brainstorm

  • We flip the default to page to get a more accurate (albeit not perfect) representation as the default model
  • Users can still fall back to route if this better suits their understanding of a session

Additional Context

Benefits

  • better mental model alignment of a session by default
  • sets us up for assigning a session id to telemetry
  • old model still available (the bundle size tax is minimal so I'd argue we keep it around)

Drawbacks/Implications

  • Can impact users' release health metrics (alerts, dashboards, etc) because once we flip the mode, the SDK will send significantly less sessions for SPA applications
    • Mitigation 1: We only ship it this in a major, call it out in the migration docs and justify it. I'd classify this as a behaviour breaking change.
    • Mitigation 2: Users can fall back to route-based lifecycle which lets them opt out of the behaviour change

Future work

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions