Improve event debouncing and throtteling
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 for
exceptions - 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
https://github.com/getsentry/sentry-unity/blob/596ad1ddcd260f44fff90c82cd737e2b32bdabc0/src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs#L57-L71
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.
since the other issue was closed as a dupe, wanted to comment on this one. this is super important for us, as we are repeatedly hitting our quota because of frame-spammed errors. it would be very helpful if this could be implemented as per-frame errors are very common and sending them multiple times is almost always useless
I hear you. I'm not dropping this and I've got a draft here https://github.com/getsentry/sentry-unity/pull/2386 I "just" need to align, especially with the other SDKs like Godot and Unreal, as to keep the behaviour somewhat consistent.
any updates on this? its still a pretty big issue and we often see issues pop up with 20k+ events in an hour with <20 users affected.
Sorry for the slow response.
Roadmap wise we've just released version 4.0.0, next up is adding support for Nintendo Switch, followed by getting a proper debouncer into the SDK.
Sorry for the slow response. Roadmap wise we've just released version
4.0.0, next up is adding support for Nintendo Switch, followed by getting a proper debouncer into the SDK.
no problem, thanks for the update. is there any way we could get a rough timeline (very rough and vague is fine) for that? it's enough of an issue for us that i might write my own temporary solution if it's too far out, but i want to avoid that if possible.