Open jose-a-rodrigues-alb opened 4 days ago
I can provide an API to start and stop the SDK from collecting data at any time. However, for sessions, I would like to understand more about your use case. Here's how sessions currently work in Measure:
A session represents a continuous period of activity in the app. A new session begins when an app is launched for the first time, or when there's been no activity for a 20-minute period. A single session can continue across multiple app background and foreground events; brief interruptions will not cause a new session to be created. This approach is helpful when reviewing session replays, as it shows the app switching between background and foreground states within the same session.
This is probably different from what analytics tools typically do for constructing a "session," which is usually tied to a user. The idea here is to make sure the session replay is useful for debugging issues that happen when state management goes wrong between app launches that happen very close to each other.
Would having the ability to start and stop the SDK from tracing based on your logic, while keeping the session management as is, help address your use case?
Here's a quick implementation to start and stop the SDK manually. https://github.com/measure-sh/measure/tree/manual-start-stop
https://github.com/user-attachments/assets/57cdb124-baaf-4740-84e8-8678befefbaa
Hi, Thanks for you answer and explanation.
Yes start/stop the ability to start and stop the SDK from tracing based on your logic is a good solution for my usecase.
I've tested the https://github.com/measure-sh/measure/tree/manual-start-stop branch and is working perfectly.
thank you.
https://github.com/measure-sh/measure/issues/1532 tracks the work needed to make this ready for production. Will make a new release when this is done.
Is your feature request related to a problem? Please describe. No.
Describe the solution you'd like I would like to have a method to end the current session. The use case i have is that i want to be able to start and end the tracing manually for a specific user by configuring the user id on firebase remote configs. I can start the tracing with Measure.init, but i haven't found any way to stop the tracing and ending the current session.
Describe alternatives you've considered The alternative i have right now is clearing the shared preferences entries that have the recent session data and force send the app to background to stop the tracing.