Skip to content
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

Propose a Change to the Browser Trace Model #20

Closed
wants to merge 2 commits into from
Closed

Conversation

mitsuhiko
Copy link
Member

@mitsuhiko mitsuhiko commented Sep 28, 2022

This RFC proposes a change to the browser (frontend) trace model so that user sessions are reusing the traces or at least continuing the sampling context. This issue relates to #14 and getsentry/sentry#39349 and the confusion it causes in the dynamic sampling configuration experience.

This RFC currently proposes to continuing the session but alternative options are possible. I will defer the decision for this RFC to @ale-cota since the main impact today is dynamic sampling.

Rendered RFC

In the most trivial case the recommendation to customers would be to pick one project that
starts traces for real user sessions. This could be *either* frontend of backend but it
should attempt to be consistent about it. In either case the client SDK should *continue the
trace* until the browser tab naturally closes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue here is with traces that then can be multiple hours long - and so then the value of analyzing a trace is completely lost.

I'm strongly against this because I feel like it'll reduce the value of trace view, and make it harder for us to expand the tracing product.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds a bit like a UX issue? I don't think that it's inherently problematic if a trace is very long, we today already do not draw much of a value out of the trace view.

To me it feels at least like there is more value to the trace being connected than the trace being split into transactions on every navigation.

Copy link
Member

@dashed dashed Sep 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User inactivity in a browser tab could be another natural way of ending a session, and beginning a new one.

There could be users that leave tabs open for a very long time, and having large time gaps between transactions might seem weird.


## Alternative B: Trace to Trace Relationships

A potential alternative would be to continue the current project but allow a trace to annotate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, in my eyes there are various correlation ID mechanisms that we chat about, and it would be nice to get an RFC going that establishes them all. Off the top of my head:

  • release id
  • user id
  • session id
  • trace id
  • profile id
  • replay id (basically a session id)

The most important relationships are as follows:

  • 1 users x R releases
  • 1 user x S sessions/replays
  • 1 user x T traces
  • 1 session/replay x T traces
  • 1 profile x 1 trace (though this is changing to 1 profile x T trace iirc)

If we can establish these concepts consistently it'll be a nice foundation for us to keep building off of

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big +1 here, i still feel like we are moving torwards treating a trace more like a session, and it will get more and more confusing with our existing sessions/releases and session replay (which is closes to what is the standard definition of a session)

The problem we are solving for to relate transactions across a user session by exanding the inclusion of more traces in a single trace for sampling, I feel will just create more fuzzy area. Confusion for us and our users.

text/XXXX-browser-traces.md Outdated Show resolved Hide resolved
Comment on lines +7 to +10
This RFC proposes to require a frontend SDK to retain a trace that it continues
until the SDK naturally ends the user session. This change is primarily to the
browser trace model to better support dynamic sampling and to create a more
coherent user experience.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this affects mobile as well since the concept is similar to the browser trace model, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it will also affect mobile - by making ui.load and resulting interaction and navigation transactions linked.

@smeubank
Copy link
Member

smeubank commented Oct 4, 2022

hi folks we had some discussions in the office and for transparency I want to share here.

Goal: Answer 3 questions:

  1. Sample on traces? & Sessions?
    • Yes. Basically we do not yet, but there is a future where IF there is a session it could be considered in the sampling decision of traces.
  2. Does a trace cross page loads? Should traces across page loads be linked?
    • A trace by definition is not across page loads. But we do agree that there is value in linking them
  3. What is the scope of a session? Intended
    • We are really only discussing sessions in the situation of a user interacting with a Frontend website. Basically it is from first interaction till end, but there are of course cases where there isn't a clear end, so there could need to be a finite nature and timeout

A graph for context. Here we see for comparison how a session covers the full scope of time of user's interaction with a website. With each row representing traces starting in a frontend and it's connected chain of services. Replay is there as a the new emerging product which has "sessions" but they are not synonymous with these user sessions.

So our input is that Sentry does want a concept of a session as shown here, a trace should not be expanded in scope to be conflated with a session. Similar to other applications and products. We should continue to research how sessions are handled in other products. Define our definitions of each term, as stated in @AbhiPrasad 's comment above, and discuss how to facilitate such contextual data, considering but not limited to Dynamic Sampling.

Example: Proposal: Supporting Real User Monitoring Events in OpenTelemetry

image

@AbhiPrasad
Copy link
Member

For Sentry internal employees - the point above by @smeubank was elaborated on by @benvinegar in https://vanguard.getsentry.net/p/cl9eb7qko33680ls604otdki9

@mitsuhiko
Copy link
Member Author

@ale-cota with the changes to how dynamic tracing will work going forward on AM2 plans the the like, the direct control customers have on traces are greatly diminished. As a result I do not believe that the original issue here is particularly impactful.

That said, I believe expressing which project originally started the trace in terms of sampling decision might still be important for when starting a trace again later on. I would propose closing this RFC and instead opening one about the particular issues related to expression sampling consistency for sessions rather than traces. Thoughts?

@ale-cota
Copy link

ale-cota commented Nov 3, 2022

@mitsuhiko yes, I agree to closing this one and opening a new one regarding user sessions instead.

@ale-cota ale-cota closed this Nov 3, 2022
@chadwhitacre chadwhitacre deleted the browser-traces branch January 19, 2023 15:45
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.

None yet

6 participants