You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And getSessionId() is only getting called when you call SessionIdSpanAppender the first time, so new session is created only when first trace is calling the span processor, not when application starts
I was able to vet the same with debugging the demo-app:
Looks like when ActivityLifecycleInstrumentation is installed, it calls AppStartupTimer to emit the app start event, that's when SessionIdSpanAppender is called, which calls session.getSessionId() and leads to 1st session creation (attaching screenshot with debug stack trace for same):
Solution: We can initialize the first session in the init block of SessionManagerImpl, that way session will start as soon as the SessionManagerImpl object is created in OpenTelemetryRumBuilder (which should be called in customer's application onCreate). Below is a stack trace showing when SessionManagerImpl is first called while debugging demo app:
The text was updated successfully, but these errors were encountered:
Thanks @surbhiia. There's a lot going on with this issue. Even though most concerns here are session related, I think it could help to foster discussion to have it broken down into a few separate single-issue issues.
surbhiia
changed the title
Issues & improvement proposals regarding Session Management
First session is not created on application start
Feb 4, 2025
First session will start when the first time anyone calls getSessionId(), until then we just have a default (id = "") session in place.
And
getSessionId()
is only getting called when you callSessionIdSpanAppender
the first time, so new session is created only when first trace is calling the span processor, not when application startsI was able to vet the same with debugging the
demo-app
:ActivityLifecycleInstrumentation
is installed, it callsAppStartupTimer
to emit the app start event, that's whenSessionIdSpanAppender
is called, which callssession.getSessionId()
and leads to 1st session creation (attaching screenshot with debug stack trace for same):SessionManagerImpl
, that way session will start as soon as theSessionManagerImpl
object is created inOpenTelemetryRumBuilder
(which should be called in customer's applicationonCreate
). Below is a stack trace showing whenSessionManagerImpl
is first called while debugging demo app:The text was updated successfully, but these errors were encountered: