DataDog/dd-sdk-flutter

Error type support

christinachimi opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
It's often helpful to be able to easily group errors to determine their overall impact and look for commonalities.

Describe the solution you'd like
I would like the errors in Error Tracking to have an Error Type, likely the exception.runtimeType of the error when available.

Describe alternatives you've considered
RUM does a pretty good job of tagging similar errors together, so if I find one that is in the category I'm interested in I can sometimes reverse engineer this. But it's not very friendly for dashboarding or at-a-glance views.

Additional context
The example that brought this up is the StateError. I am transitioning off of another error tracking tool that presented me with a trending StateError in my app. When I tried to find that same error in RUM, I could not (until I realized that StateError wasn't actually mentioned in the tracker, and that I had to search for the underlying "Bad state" message).

Hi @christinachimi, thanks for the report!

Yes, this looks like an oversight in the API for RUM. I'll look into adding it soon.

As a workaround. Logging (and Error Tracking in Logs) does support sending an Error Type as a String, and there should be no issues sending errors to both Logs and RUM if that will work for you.

Modify your error reporting initialization code with the following:

      DatadogSdk.instance.logs?.error(
        e.toString(),
        message: e.toString(),
        errorKind: e.runtimeType.toStirng()
        stackTrace: s,
      );
    });

Note that runtimeType will not be usable in Obfuscated build, as it won't return the name of the actual type. If you need to track s specific type of error and you're obfuscating, I would catch it and manually report that type in the "errorKind" element.