From 860328c03fee208bdc50c5030fe1588113910874 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 17 Jun 2026 10:13:10 +0200 Subject: [PATCH] fix(P13): route transient Segment send-loop errors off Sentry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UNITY-EXPLORER-P13 (637 evts/242 users — widest reach): "Segment error: Error executing send loop (will retry): ClientError {...}". The Rust Segment SDK's background send loop reports transient, self-recovering upload failures via ErrorCallback, which called ReportHub.LogException → Sentry (error level). The existing once-per-session guard still emitted one Sentry error per user. Route "(will retry)" messages to LogWarning on ReportHandler.DebugLog (local log, never Sentry); genuine non-transient Segment errors keep Sentry reporting. Removed the now-unused ONCE_PATTERN_ALREADY_CAUGHT field. Report-noise reduction. Unverified. Co-Authored-By: Claude Opus 4.8 (1M context) Production evidence (decentraland Sentry, archive snapshot 2026-07-17): - UNITY-EXPLORER-P13: 29 events / 15 users, last seen 2026-07-16 - UNITY-EXPLORER-JVR: 8 events / 1 users, last seen 2026-02-22 --- .../RustSegmentAnalyticsService.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Explorer/Assets/Plugins/RustSegment/SegmentServerWrap/RustSegmentAnalyticsService.cs b/Explorer/Assets/Plugins/RustSegment/SegmentServerWrap/RustSegmentAnalyticsService.cs index 93a73fe2ab2..0e959e37bb3 100644 --- a/Explorer/Assets/Plugins/RustSegment/SegmentServerWrap/RustSegmentAnalyticsService.cs +++ b/Explorer/Assets/Plugins/RustSegment/SegmentServerWrap/RustSegmentAnalyticsService.cs @@ -49,9 +49,6 @@ private enum Operation private long trackId; private long flushId; - // temportal sentry budget fix. TODO remove once the core issue solved - private static bool ONCE_PATTERN_ALREADY_CAUGHT = false; - public RustSegmentAnalyticsService(string writerKey, string? anonId) { using Mutex.Guard instanceGuard = CURRENT.Lock(); // IGNORE_LINE_WEBGL_THREAD_SAFETY_FLAG @@ -234,18 +231,17 @@ private static void ErrorCallback(IntPtr msg) string marshaled = Marshal.PtrToStringUTF8(msg) ?? "cannot parse message"; bool isCaught = marshaled.Contains(ONCE_PATTERN); - if (isCaught && ONCE_PATTERN_ALREADY_CAUGHT) + if (isCaught) { - // Don't log if already was + // Transient, self-recovering analytics-upload failure (the SDK retries): this is + // report-noise, not a hard error. Route to the local debug log only — never Sentry — + // so it stops generating Sentry errors (UNITY-EXPLORER-P13: 637 events / 242 users). + ReportHub.LogWarning(ReportCategory.ANALYTICS, $"Segment error: {marshaled}", ReportHandler.DebugLog); return; } + // Genuine, non-transient Segment errors keep full Sentry reporting. ReportHub.LogException(new Exception($"Segment error: {marshaled}"), ReportCategory.ANALYTICS); - - if (isCaught) - { - ONCE_PATTERN_ALREADY_CAUGHT = true; - } } catch {