Data usage?
leroy30
Posted on
Sep 29 2014
Is there a way to cap the number of errors send per day from a client device?
We recently implemented raygun in our android app and all of a sudden one of our customers reported a HUGE spike in data usage on our app (1.5gb in 3 days). Whilst there is no indication it could be because of Raygun, I want to implement some control to prevent that situation from happening.
We have not seen many errors come through so I doubt it is Raygun but it opened my eyes to the potential for it to happen! (i.e. if we had a bug on a particular device that saw it throwing errors in our background service over and over).
jeremy
Raygun
Posted on
Sep 29 2014
There is no inbuilt mechanism for this as we want to ensure all messages are sent but you can implement some custom logic to control this as needed. You will most likely want to look at having a central class/method for sending exceptions to the Raygun provider rather than calling the provider directly in your exception handling code. Using this approach you could then implement a basic time based rate limit to control the number of messages being sent by the client.
e.g. Add a counter variable to increment on each call to send, a datetime variable to hold the time you last reset the count and constant values to indicate the maximum messages per interval and the interval length. On each call to send check if the interval since the last clear has been exceeded and if so clear the counter, increment the counter, then check if the counter value has exceeded the maximum messages per interval. If it has then exceeded the value then do not call the Raygun provider to send the details otherwise send the details.
Jeremy
leroy30
Posted on
Sep 29 2014
What about using the RaygunClient.Attach method? We would need to extend that somehow?
I guess I could attach my own global handler and manually send an exception there. I was just hoping there was something out of the box ;)
Thanks.
Jamie Penney
Posted on
Sep 29 2014
You could attach to the SendingMessage event on your RaygunClient object, and set the Cancel property on the event args to true to prevent sending.