Sentry-java: Disk Buffer Functionality Not Available In Sentry Java 3?

Created on 20 Nov 2020  路  7Comments  路  Source: getsentry/sentry-java

The sentry disk buffer functionality for offline reporting doesn't seem to be present in the 3.* SDK. And there is nothing about it in the docs.
I am using it with a log4j2 integration.

Is is actually available? If yes, how to enable it in sdk 3?
If not, is there any ways to handle offline reporting?

If this is no longer supported what the strategy for handling lack of connectivity?

enhancement

Most helpful comment

@marandaneto
I know it's only been 2 months but we're about to get started with this and it would be really helpful to know the general direction
Whether or not this is on the roadmap
Thank you

All 7 comments

@michelbitar-99 thanks for raising this.

It's not supported ootb because usually backend apps are online 100% of the time and also because IO could become a bottleneck if there a ton of requests per second.

We do support the disk buffer for Android and they share the same code base, so it'd not be that hard to bring this in, I'm going to discuss this internally.

cc @bruno-garcia

Having the disk buffer for java applications that my team is very interested in. This was a valuable feature for us in version 1 as many of our normal java applications and wildfly applications only touch the internet periodically.

Thanks @michelbitar-99, I have the same concern

@marandaneto, I'd say the assumption that apps using the Java SDK are online 100% of the time usually holds except in a few very important cases when it doesn't.

  • Backend apps can be online but lose connectivity to Sentry. Sentry could be down. Some temporary firewall issues or other IT hiccups can block outgoing access to Sentry for some time..
  • In case of on-premise installations of Sentry, especially with smaller orgs, 0-downtime of Sentry itself is not always possible. We would like not to lose errors generated during Sentry maintenance windows.
  • Finally, and I'd say most importantly, the Java SDK can also be used for non-backend apps. Our org uses it in an IOT-like setup where connectivity is not always guaranteed. It's actually one of the top reasons we chose Sentry in the first place.

@jadbaz thanks for your insightful comment, we'll for sure consider it, but I can't promise any deadlines, for now, focusing on the Performance feature.

As I said, it's not supported ootb but the code base has all the necessary bits, if you create your own SentryOptions and Hub, setting all the necessary bits, you can achieve this easily, no code changes required.
You basically need to mimic the Android bits which live here:

https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java#L211

https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java#L118-L120

Ideally, we'd expose a bool to toggle this feature automatically.
Also, cached events would be sent only on App. restart which is suboptimal for Server apps, a mechanism like #912 would improve this.

If one of you feels submitting a PR, I'd love to guide & review btw.

Thank you @marandaneto, I guess for now we'll stick to the legacy SDK and we'll impatiently wait for this feature to be added to the new SDK.

@marandaneto
I know it's only been 2 months but we're about to get started with this and it would be really helpful to know the general direction
Whether or not this is on the roadmap
Thank you

@bruno-garcia for visibility

Was this page helpful?
0 / 5 - 0 ratings