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

🐛 fix for timer getting reset on retrival of session id #467

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Archish27
Copy link
Contributor

Whenever we are getting session id, timer for sessionid idle gets updated. Ideally the timer should be updated only when the session is expired or reached maxed timeout.

Due to current behaviour, when accessing session id when app background the timer gets updated.

@Archish27 Archish27 requested a review from a team July 4, 2024 06:57
@LikeTheSalad
Copy link
Contributor

LikeTheSalad commented Jul 4, 2024

Hi @Archish27

The current behavior is based on the idea that a session would last for as long as a user is using the app, this makes sense when looking at it from the perspective that a session is driven by a user's interaction at a given time, because of this, the way that a session would end is due to user inactivity (which is one of the reasons to end a session mentioned here) And another way could be by setting a hard stop max amount of time for a session (for example 4 hours) as a way to prevent sessions from becoming too large to be feasible to read/query later.

Based on the above, the existing behavior is working as intended, as we reset the timeout every time there's a new telemetry event happening, which is what we take as a signal that the app isn't "idle". If there's no telemetry data generated before the timeout expires, then we consider the app to be "idle" and that's when we create a new session.

However, having said that though, this idea of making sessions expire based on a fixed amount of time, or having to reset them, or having a max amount of time, etc, is something that's currently being discussed in the Client SIG (#otel-client-side-telemetry in Slack), where @bidetofevil is taking care of providing a detailed definition of what a session is, which will affect the way we're handling sessions in this project. Probably a new definition would allow for providing more customized logic where apps can decide when a session starts and ends based on the app's specific needs, so for now what I can recommend you is to have a look at Hanson's proposal here and provide some feedback if needed to try and find a solution that can suit different use cases.

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.

2 participants