-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Goal
The goal is to provide more granular control over event debouncing. Particularly, for high-frequency events like those from Update() functions. This allows users to preserve quota while keeping error reporting intact.
Current Problem
- Events from
Update()functions that run every frame can quickly consume error reporting quotas - Current debouncing is not flexible enough for different types of events.
i.e. There's not debouncing forexceptions - Existing workarounds in
BeforeSend(stack trace checking + random sampling) are hacky and might miss important errors
Current Implementation
We're using the following debouncer https://github.com/getsentry/sentry-unity/blob/main/src/Sentry.Unity/TimeDebounceBase.cs
in the Application Logging Integration
sentry-unity/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs
Lines 57 to 71 in 596ad1d
| if (_options?.EnableLogDebouncing is true) | |
| { | |
| var debounced = logType switch | |
| { | |
| LogType.Error or LogType.Assert => _errorTimeDebounce?.Debounced(), | |
| LogType.Log => _logTimeDebounce?.Debounced(), | |
| LogType.Warning => _warningTimeDebounce?.Debounced(), | |
| _ => true | |
| }; | |
| if (debounced is not true) | |
| { | |
| return; | |
| } | |
| } |
Proposal
Replace the current solution with a content-based deduplication system using an interface pattern similar to callbacks in the SDK (like BeforeSend, BeforeBreadcrumb, TracesSampler etc.).
The idea is to add an IDebounce to the SentryUnityOptions with a default implementation that can be overwritten by the user.
The default Implementation would take the log message and a couple of stack frames, create a hash and hold a fixed size buffer of those for a set amount of time. The individual variables would not be configurable, users can implement their own solution.
The added benefit is that we would run this before IL2CPP stack trace processing, further minimizing the overhead.
Additional Consideration
The .NET SDK has its own debouncer now (for memory dumps). Can this be reused?
The Godot SDK has event throtteling implemented as part of its logging intgration.
Metadata
Metadata
Assignees
Labels
Projects
Status
Status