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

First session is not created on application start #781

Open
surbhiia opened this issue Jan 30, 2025 · 2 comments
Open

First session is not created on application start #781

surbhiia opened this issue Jan 30, 2025 · 2 comments

Comments

@surbhiia
Copy link
Contributor

surbhiia commented Jan 30, 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 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):
Image
  • 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:
Image
@breedx-splk
Copy link
Contributor

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 surbhiia changed the title Issues & improvement proposals regarding Session Management First session is not created on application start Feb 4, 2025
@surbhiia
Copy link
Contributor Author

surbhiia commented Feb 4, 2025

Divided it into separate issues!

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

No branches or pull requests

2 participants