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

Review offline support #3739

Open
bruno-garcia opened this issue Nov 8, 2024 · 5 comments
Open

Review offline support #3739

bruno-garcia opened this issue Nov 8, 2024 · 5 comments

Comments

@bruno-garcia
Copy link
Member

A customer who has a MAUI app that goes offline for extended amount of time has reported that events are getting lost.
No client reports indicate data being dropped.

I expected at least:

_options.ClientReportRecorder.RecordDiscardedEvents(DiscardReason.CacheOverflow, envelope);

Reading the code it seems like we don't delete files if the failure reason is network connectivity:

catch (Exception ex) when (IsNetworkError(ex))
{
if (_options.NetworkStatusListener is PollingNetworkStatusListener pollingListener)
{
pollingListener.Online = false;
}
_options.LogError(ex, "Failed to send cached envelope: {0}, retrying after a delay.", file);
// Let the worker catch, log, wait a bit and retry.
throw;

But I believe we should run some tests:

  1. Put the simulator offline. Generate some events. Let the buffer fill (30 by default), do we get the client reports?
  2. If the failure is a timeout, do we delete the issue (aka: review the heuristics for "Network Error")
@bricefriha
Copy link
Collaborator

@bruno-garcia, did the user tell you the platforms are affected? (I assume any of them)

@bruno-garcia
Copy link
Member Author

bruno-garcia commented Nov 11, 2024

@bruno-garcia, did the user tell you the platforms are affected? (I assume any of them)

Happens on Android/iOS, but offline caching happens in C# so I imagine testing this on Windows/macOS should yield the same result and easier on the devloop

@bruno-garcia
Copy link
Member Author

bruno-garcia commented Nov 15, 2024

Confirmed this is known to happen on iOS. Android doesn't have enough usage yet to be sure.
@bricefriha any luck with investigating this?

@bruno-garcia
Copy link
Member Author

While chatting with the customer, an idea to keep track of the count of errors Sentry is capturing, from outside Sentry itself:

// Some field to keep the counter:
int _eventCounter = 0;

// in the Init code of Sentry:
options.SetBeforeSend((evt, hint) => {
  Interlocked.Increment(ref _eventCounter);
});

// At the point where we'd like to report this to our backed:

async Task ReportData() {
// Reset the counter to 0
var lastCountValue = Interlocked.Exchange(ref _eventCounter, 0);

// Send the current count to our backend so we can check against their reports, and againt what's in Sentry
await _apiService.PostAddErrorCount(CurrentUser, lastCountValue);

@bricefriha
Copy link
Collaborator

any luck with investigating this?

I tried using Android but couldn't reproduce this. I'll try using iOS with the error count you mentioned above.

Is it possible that it'd related to NativeAOT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants