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

Limit number of stored errors #97

Merged
merged 2 commits into from
Jan 20, 2016
Merged

Limit number of stored errors #97

merged 2 commits into from
Jan 20, 2016

Conversation

duncanhewett
Copy link
Contributor

Limit the number of errors stored for later sending to prevent possible disk space issues (see #23).

Stores up to 100 errors and discards any subsequent errors. First 100 errors are stored on the basis that they are likely to be the most interesting. Is this sensible?

@kattrali
Copy link
Contributor

Looks good. This makes sense, though I think in the case that we reach the limit, we should probably discard the oldest errors instead of the newest ones. I'm not sure on what is a reasonable limit though.

@duncanhewett
Copy link
Contributor Author

Changed to delete the oldest error and store the new one.

100 seems like a reasonable number - if you have that many errors it is most likely the same thing repeatedly so there is probably limited value to reporting additional instances anyway.

@kattrali
Copy link
Contributor

Awesome! 👍

@d4rken
Copy link
Contributor

d4rken commented Jan 19, 2016

How much space do 100 errors take up? Where are they stored by default?

@kattrali
Copy link
Contributor

@d4rken The files are stored in the cache directory.

@duncanhewett
Copy link
Contributor Author

The size will depend on lots of things like how big/deep the stack traces are and what custom meta-data is being added, but each error could end up being 10s of KB each at least.

Storing 100 is not going to take up a huge amount of space but seems sensible to be conservative about the number of errors to store. Happy to change it if anyone has a different opinion though!

@d4rken
Copy link
Contributor

d4rken commented Jan 20, 2016

Seems reasonable as default number.

kattrali added a commit that referenced this pull request Jan 20, 2016
@kattrali kattrali merged commit 7f0a626 into master Jan 20, 2016
@kattrali kattrali deleted the limit-stored-errors branch January 20, 2016 15:46
@d4rken
Copy link
Contributor

d4rken commented Jan 20, 2016

@duncanhewett

I think code comments don't show anymore when the PR is merged?

Are my concerns valid or did i miss something? I must admit I'm not 100% versed in how the offline storage works at the moment.

7f0a626#commitcomment-15562085

7f0a626#commitcomment-15562415

If these are valid i would make an issue ticket and when I find time a PR.

@duncanhewett
Copy link
Contributor Author

@d4rken I thought I'd reply here for visibility:

What guarantees that this always sorts such that index 0 is the oldest one?

It ultimately uses the default sort from File.compareTo() which should order alphabetically. As the files are named with a timestamp, the smallest value (oldest time) is always at index 0.

Maybe we should check how many errors are above the LIMIT and delete multiple at once instead of only always the last .... impact of this would be pretty minor though as eventually the error store should be emptied.

I considered that we may end up with more than 100 if delete fails, but as it's an arbitrary limit I don't think it matters too much (as you suggest).

@d4rken
Copy link
Contributor

d4rken commented Jan 20, 2016

Ok 👍

kattrali added a commit to bugsnag/bugsnag-unity that referenced this pull request Apr 15, 2016
Android Changelog
====

## 3.4.0 (2016-03-09)

### Enhancements

- Limit the number of stored errors
  [Duncan Hewett](https://github.com/duncanhewett)
  [#97](bugsnag/bugsnag-android#97)

### Bug Fixes

- Fix `ConcurrentModificationException` which could occur when saving
  breadcrumbs
  [Duncan Hewett](https://github.com/duncanhewett)
  [#98](bugsnag/bugsnag-android#98)

- Localize all numbers in error metrics
  [Delisa Mason](https://github.com/kattrali)
  [#100](bugsnag/bugsnag-android#100)

3.3.0 (2016-01-18)
-----

### Enhancements

- Change distribution method to be .aar only
  [Lars Grefer](https://github.com/larsgrefer)
  [#91](bugsnag/bugsnag-android#91)

- Skip sending empty device data values
  [Matthias Urhahn](https://github.com/d4rken)
  [#96](bugsnag/bugsnag-android#96)

- Remove the need for synthetic methods
  [Jake Wharton](https://github.com/JakeWharton)
  [#87](bugsnag/bugsnag-android#87)

3.2.7 (2015-12-10)
-----

### Enhancements

- Add additional check to ensure the cache of uploaded errors are deleted
  [#80](bugsnag/bugsnag-android#80)

### Bug Fixes

- Fix exception which occurs when `appContext.getResources()` is null
  [#78](bugsnag/bugsnag-android#78)

- Fix bug preventing `maxBreadcrumbs` from being set
  [David Wu](https://github.com/wuman)
  [#70](bugsnag/bugsnag-android#70)

3.2.6
-----
-   Add blocking API
-   Fix NPE issue
-   Concurrent adding to tabs
-   Thread Safe DateUtils#toISO8601
lemnik pushed a commit that referenced this pull request Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants