Skip to content

Commit 860328c

Browse files
Esteban Ordanoeordano
authored andcommitted
fix(P13): route transient Segment send-loop errors off Sentry
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) <noreply@anthropic.com> 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
1 parent 8584628 commit 860328c

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

Explorer/Assets/Plugins/RustSegment/SegmentServerWrap/RustSegmentAnalyticsService.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ private enum Operation
4949
private long trackId;
5050
private long flushId;
5151

52-
// temportal sentry budget fix. TODO remove once the core issue solved
53-
private static bool ONCE_PATTERN_ALREADY_CAUGHT = false;
54-
5552
public RustSegmentAnalyticsService(string writerKey, string? anonId)
5653
{
5754
using Mutex<RustSegmentAnalyticsService>.Guard instanceGuard = CURRENT.Lock(); // IGNORE_LINE_WEBGL_THREAD_SAFETY_FLAG
@@ -234,18 +231,17 @@ private static void ErrorCallback(IntPtr msg)
234231
string marshaled = Marshal.PtrToStringUTF8(msg) ?? "cannot parse message";
235232
bool isCaught = marshaled.Contains(ONCE_PATTERN);
236233

237-
if (isCaught && ONCE_PATTERN_ALREADY_CAUGHT)
234+
if (isCaught)
238235
{
239-
// Don't log if already was
236+
// Transient, self-recovering analytics-upload failure (the SDK retries): this is
237+
// report-noise, not a hard error. Route to the local debug log only — never Sentry —
238+
// so it stops generating Sentry errors (UNITY-EXPLORER-P13: 637 events / 242 users).
239+
ReportHub.LogWarning(ReportCategory.ANALYTICS, $"Segment error: {marshaled}", ReportHandler.DebugLog);
240240
return;
241241
}
242242

243+
// Genuine, non-transient Segment errors keep full Sentry reporting.
243244
ReportHub.LogException(new Exception($"Segment error: {marshaled}"), ReportCategory.ANALYTICS);
244-
245-
if (isCaught)
246-
{
247-
ONCE_PATTERN_ALREADY_CAUGHT = true;
248-
}
249245
}
250246
catch
251247
{

0 commit comments

Comments
 (0)