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

Unable to determine when all events have been uploaded #1190

Open
n8ta-msft opened this issue Aug 1, 2023 · 1 comment
Open

Unable to determine when all events have been uploaded #1190

n8ta-msft opened this issue Aug 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@n8ta-msft
Copy link
Contributor

Steps to reproduce.
UploadNow() is a non-blocking function

LogManager.UploadNow();
ExitApp();

Will reliably lose telemetry.

For our use case we need to be able to attempt to send telemetry ASAP and have way to know if it has finished before we exit our app. We want to send data right away not flush to disk since this is part of a crash reporter and we do not want to have a long delay before we receive crash information.

Solutions
Open to suggestions but we need a way to determine that all, or just a given event, has been sent so we know we can exit. Obviously in some cases it won't be possible to send events so perhaps a callback or a Result return value is needed.

@n8ta-msft n8ta-msft added the bug Something isn't working label Aug 1, 2023
@n8ta-msft n8ta-msft changed the title Unable to determine when all events have n Unable to determine when all events have been uploaded Aug 1, 2023
@maxgolov
Copy link
Contributor

maxgolov commented Sep 13, 2023

UploadNow has no guarantee whatsoever that it will actually even trigger the upload. It may be discarded if you immediately tearddown the SDK. The proper way to handle it is to set the configuration to wait for certain number of seconds:

   config[CFG_INT_MAX_TEARDOWN_TIME] = 2; // max number of seconds to try pushing HTTP posts thru

And invoke LogManager::FlushAndTeardown(), which will wait for up to 2 seconds to try push your data. Typically milliseconds. I think there's a possible issue with this in latest code, however, since it appears like this functionality has been broken for some time. See #1120 . This feature operates well on SDK build from June 2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants