sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Logs: Batch Processor Minimize Data Loss

Open philipphofmann opened this issue 2 months ago • 6 comments

Description

Comply with the new spec added with this PR to the BatchProcessor develop docs, which minimizes data loss by sending spans in memory in a couple of scenarios. For more info, see the project in Linear.

philipphofmann avatar Oct 22 '25 07:10 philipphofmann

RN-371

linear[bot] avatar Oct 22 '25 07:10 linear[bot]

@philipphofmann Are we going to have 2 Batch Processors for Hybrid SDKs? One for JavaScript envelopes and other for the Native ones? Or are we going to sync both sides in the native Batch Processor?

If we opt for only one Batch Processor, a nice change would be for [PrivateSentrySDKOnly captureEnvelope:envelope] and InternalSentrySdk.captureEnvelope to redirect the envelopes to the native Batch Processor

lucas-zimerman avatar Oct 29 '25 15:10 lucas-zimerman

@lucas-zimerman, my plan would be that the hybrid SDKs will pass down every log and span to the native batch processors, especially for logs for crashes. Not losing any logs for abnormal process terminations is a bit tricky and I wrote a spec for this here: https://github.com/getsentry/sentry-docs/pull/15274/files

Do you think that would work?

philipphofmann avatar Oct 30 '25 10:10 philipphofmann

@lucas-zimerman, my plan would be that the hybrid SDKs will pass down every log and span to the native batch processors, especially for logs for crashes. Not losing any logs for abnormal process terminations is a bit tricky and I wrote a spec for this here: https://github.com/getsentry/sentry-docs/pull/15274/files

Do you think that would work?

Sounds good to me! I think, the way it is set, we don't really need to queue logs for 5 seconds and then capture, we could send it straight to the Batch processor queue and the timeout will be applied there, what do you think? Or do we still need the delayed queue for Logs separately?

lucas-zimerman avatar Oct 31 '25 11:10 lucas-zimerman

Blocked by https://github.com/getsentry/sentry-java/issues/4826, https://github.com/getsentry/sentry-cocoa/issues/6478 and maybe https://github.com/getsentry/sentry-javascript/issues/17994

lucas-zimerman avatar Nov 03 '25 14:11 lucas-zimerman

I think, the way it is set, we don't really need to queue logs for 5 seconds and then capture, we could send it straight to the Batch processor queue and the timeout will be applied there, what do you think? Or do we still need the delayed queue for Logs separately?

I would just directly forward it to the native batch processors. It's simpler and works better for crash scenarios.

philipphofmann avatar Nov 03 '25 16:11 philipphofmann