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

Sampled session should span across app lifetimes #957

Open
AvdLee opened this issue Aug 4, 2022 · 3 comments
Open

Sampled session should span across app lifetimes #957

AvdLee opened this issue Aug 4, 2022 · 3 comments
Assignees

Comments

@AvdLee
Copy link
Contributor

AvdLee commented Aug 4, 2022

With an applied sample rate: if the user goes into a background and a new session starts after the user returns after ~30 minutes, it's now possible this new session won't be sampled.

This is the question I'm trying to answer:

  1. User is sampled
  2. Starts a background upload
  3. App goes into the background
  4. User gets back after 30 minutes, and the upload is finished
  5. Datadog does not sample this new session
  6. We never get back an upload completion event

I understood from @ncreated a potential fix would be to apply the sample rate as follows:

sampleRate: random(0...1) < 0.2 ? 100: 0

However, ideally, this would be handled as an option inside the SDK.

@AvdLee
Copy link
Contributor Author

AvdLee commented Aug 4, 2022

Actually, what might be a better fix would be to add an option to reuse the sampled rate from the previously expired session here:

Something like:

self.init(
    isInitialSession: false,
    parent: expiredSession.parent,
    startTime: startTime,
    dependencies: expiredSession.dependencies,
    isSampled: configuration.shouldInheritExpiredSessionSampling ? expiredSession.isSampled : <apply sampling>
)

@maxep maxep self-assigned this Aug 9, 2022
@maxep
Copy link
Member

maxep commented Aug 9, 2022

Hey @AvdLee! Thank you for your report.

We have several conditions that define a user session lifecycle, we basically restart a new session after:

  1. application start.
  2. 15mns of inactivity (no interaction)
  3. current session last more than 4hrs

Your use case falls under that second condition, which prevents reporting the completion of the resource upload which last more than 15mns. It doesn't have to do with sampling and there is no easy fix sadly.

We are considering several approaches to tackle this use case which will require discussion internally since our user session definition in RUM is crossplatform.

I will keep the ticket open and keep you posted with any updates.

@AvdLee
Copy link
Contributor Author

AvdLee commented Aug 10, 2022

Thanks @maxep, keep me posted! For now we've configured our own sample rate randomizer, trying to see whether that improves our insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants