Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to exclude some specific errors from being reported as RUM errors from the OkHttp DatadogInterceptor? #2426

Closed
StylianosGakis opened this issue Dec 2, 2024 · 4 comments
Labels
question Further information is requested

Comments

@StylianosGakis
Copy link

Question

Using the built-in datadog interceptor on our OkHttp instance, we get errors reported for IOExceptions that are originating from the request just being cancelled. This in our app happens basically any time some request may have started, but then the user navigates away from the screen, so we cancel the screen's CoroutineScope, which in turn can cancel some ongoing network requests.
These errors then get reported o RUM, where we see the exception starting with "java.io.IOException: Canceled...".
This messes up with our SLOs tracking due to those request being marked as errors, while they are just typical App behavior and there is nothing concerning about them.

I wonder two things here
a) Do you think this should not be happening and that we got something setup wrong?
b) If it works as intended, is there a way for us to exclude those errors from being reported as such in RUM?

@StylianosGakis StylianosGakis added the question Further information is requested label Dec 2, 2024
@StylianosGakis
Copy link
Author

StylianosGakis commented Dec 2, 2024

What I have done as a temporary measure is to instead filter those out on our metrics instead, by filtering out those errors by adding this to my query [email protected]:java.io.IOException\:\ Canceled* so if the stacktrace begins with exactly that error message that OkHttp seems to throw here.

@ambushwork
Copy link
Member

ambushwork commented Dec 3, 2024

Hi @StylianosGakis,

Thank you for your feedback! If I understand your requirement correctly, you can try using setEventMapper in the RumConfiguration to filter out unnecessary errors. We'll continue working on this to explore potential ways to make this functionality more convenient in the DatadogInterceptor.

@StylianosGakis
Copy link
Author

Hmm interesting I was not aware of that functionality.
So I could potentially intercept the events there, try to see if I can detect when that one in particular is trying to be logged, and transform it into null which will simply completely drop that event. Is that understanding correct here?

something like:

...setErrorEventMapper(
  EventMapper { event ->
    if (event.matchesMyRequirements()) {
      null
    } else {
      event
    }
  }
)

@0xnm
Copy link
Member

0xnm commented Dec 9, 2024

Hi @StylianosGakis! Yes, RUM and Logs mappers are created to modify/filter out low-level events to the sent to Datadog, so this is a valid use case and your snippet is correct: by returning null event will be dropped and not sent to Datadog.

I'm closing this issue since it is solved, but don't hesitate to re-open it if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants