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

Sending cached events periodically #912

Closed
nominalista opened this issue Apr 16, 2020 · 17 comments
Closed

Sending cached events periodically #912

nominalista opened this issue Apr 16, 2020 · 17 comments
Assignees
Labels
enhancement New feature or request Platform: Android

Comments

@nominalista
Copy link

Because some of the events may be not be sent immediately after they are created, it would be great if there was an option to send these events periodically, even if the app is not restarted.

Is there any method in SDK that I can call and try to send cached events? I would use it as a temporary solution along with e.g. WorkManager.

@marandaneto
Copy link
Contributor

as agreed, I'll mark it as a feature request, thanks @nominalista
related to getsentry/sentry-android#360

@nominalista
Copy link
Author

Thanks @marandaneto. Just to be sure - are you considering the whole periodic mechanism or only method that would allow to send cached events? If whole mechanism, is such method already existing?

@marandaneto
Copy link
Contributor

the mechanism to send periodically is something to be done, this is the feature request.
the method to send cached events are already in place as mentioned in getsentry/sentry-android#360 SendCachedEventFireAndForgetIntegration
https://github.com/getsentry/sentry-android/blob/master/sentry-core/src/main/java/io/sentry/core/SentryOptions.java#L817

If you use this integration periodically, it'd work, but it might be racey, be aware of that.

@nominalista
Copy link
Author

Ok, thank you!

@bruno-garcia bruno-garcia transferred this issue from getsentry/sentry-android Sep 11, 2020
@marandaneto marandaneto added Platform: Android enhancement New feature or request labels Sep 17, 2020
@jadbaz
Copy link

jadbaz commented Jan 22, 2021

@marandaneto, how is it possible to use the integration periodically (as you mentioned in your last comment)?

@marandaneto
Copy link
Contributor

this issue isn't Android specific, hence removing the Android label

@marandaneto
Copy link
Contributor

@jadbaz this feature isn't supported yet, I'd prefer to not share a hacky solution with flawns, please upvote the issue, and let's see if we can get prioritized.

@jadbaz
Copy link

jadbaz commented Jun 2, 2021

Hello,
Just checking up if this is on the roadmap at some point

@ghost
Copy link

ghost commented Jul 26, 2021

I think this is really important for client apps and I'm also waiting for this.

@bruno-garcia
Copy link
Member

bruno-garcia commented Mar 2, 2022

We've expanded the offline caching feature guidelines further: https://develop.sentry.dev/sdk/features/#buffer-to-disk

Relates to: getsentry/sentry-dotnet#1504

@marandaneto
Copy link
Contributor

It'd benefit when you have an unstable connection, or no connection at all.
Events are always sent on restart anyway.
Also when you never close/kill the app very often, the OS does it anyways when memory is needed.

The next step would be to implement an improvement already made by the Sentry Cocoa SDK, which is sending every pending envelope once an envelope is captured.
So if you capture an envelope and you have no connection, the envelope is cached, if you capture another envelope and there's connection, both envelopes would be sent.

How does that sound?

@vibin
Copy link

vibin commented Jun 6, 2022

@marandaneto FWIW, I like that Sentry doesn't use WorkManager/AlarmManager, etc. to auto-initialise background jobs for sending cached events – because, I have a usecase where I initialise Sentry conditionally (only if a feature flag is on).

I see that currently SendCachedEnvelopeFireAndForgetIntegration is the class that is responsible for pushing cached events on app initialisation, so it's working well for my usecase

@farfromrefug
Copy link

I am very interested with such a feature. One thing that could be done to help apps is to implement the io.sentry.Sentry.flush method. Wondering if this could be done by using this https://github.com/getsentry/sentry-java/blob/469420402e4717906783a744f8e2fb156168ec25/sentry/src/main/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegration.java

@kahest kahest moved this from Backlog to Needs Discussion in Mobile & Cross Platform SDK Aug 28, 2023
@markushi
Copy link
Member

markushi commented Aug 30, 2023

After some discussion we're considering to close this in favor of:

  1. Send cached and pending envelopes when an envelope is going to be sent #1932
  2. Observing for network changes and resend any uncached envelopes (Offline caching improvements - Delay between and backoff when 429 is on #1926)
  3. (Optional) Allow manually triggering this, aka extending Sentry.flush()

@farfromrefug Given that we'll implement 1 and 2, would you still be interested in having a manual (3) option?

@markushi markushi moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Aug 30, 2023
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 Aug 30, 2023
@farfromrefug
Copy link

@markushi if possible yes that would be good I think. The case I see is a failure to send on envelop added (like server down or error) and then the app would like to force a "try again"

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 Aug 30, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Sep 5, 2023
@romtsn
Copy link
Member

romtsn commented Sep 6, 2023

Let's create a new issue dedicated to providing manual API for force-flushing pending envelopes and close this one. @markushi

@markushi
Copy link
Member

markushi commented Sep 6, 2023

Closing this in favor of #2920, please upvote the issue to give it more priority!

@markushi markushi closed this as completed Sep 6, 2023
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in Mobile & Cross Platform SDK Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Android
Projects
Archived in project
Archived in project
Development

No branches or pull requests

10 participants