sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Set synthetic field

Open philipphofmann opened this issue 4 years ago • 7 comments

The exception interface of the event payload defines a field synthetic, which doesn't exist in the SDK. This messes up grouping and should be added to the SDK. Since this has an impact on grouping, we have to bump a major for this.

philipphofmann avatar Jun 23 '21 15:06 philipphofmann

this field should also be set to true whenever there's a stack trace, eg, segfault etc

marandaneto avatar Jun 24 '21 07:06 marandaneto

Maybe talk to @untitaker before shipping this.

philipphofmann avatar Mar 01 '22 15:03 philipphofmann

greetings. in which cases do you want to set the field? I believe setting it in all cases is wrong.

untitaker avatar Mar 01 '22 15:03 untitaker

I can't remember why I created this issue. If you, @untitaker, tell me we shouldn't use the field, I'm happy to close the issue.

philipphofmann avatar Mar 01 '22 15:03 philipphofmann

Ah right. So we have two classes of exceptions in cocoa as far as I remember:

  1. the ones where the current thread's stacktrace is reported as exception stack (nserror?)
  2. genuine exceptions that actually hold a stacktrace produced from the exception bubbling up (nsexception?)

number (1) is the case where I believe we should set synthetic

we currently detect nserror on the server and set synthetic ourselves, but I believe the SDKs should set this property themselves, because this approach of doing a bunch of pattern-matching on the server doesn't scale with amount of platforms

untitaker avatar Mar 01 '22 15:03 untitaker

I can't remember why I created this issue. If you, @untitaker, tell me we shouldn't use the field, I'm happy to close the issue.

This issue came up after talking to @mitsuhiko Native events should set the synthetic field when captured by signal handlers. The reason is described in the docs.

marandaneto avatar Mar 01 '22 16:03 marandaneto

Thanks, @marandaneto and @untitaker for the info.

philipphofmann avatar Mar 07 '22 13:03 philipphofmann

Setting synthetic=true for NSErrors breaks grouping by NSErrors domain and code. @untitaker, where on the server do you think you set synthetic=true for NSError?

According to the develop docs

Sentry will then try to use other information (top in-app frame function) rather than exception type and value in the UI for the primary event display.

We definitely don't want this for NSError. We want domain and code for primary event display. I currently can't think of any events where we would have to set synthetic=true. Maybe MetricKit events could use that field.

philipphofmann avatar Dec 06 '22 16:12 philipphofmann

@mitsuhiko @danielkhan

I think we can close this. NSError is indeed not a synthetic exception, and the server does not detect it as synthetic exception.

untitaker avatar Dec 06 '22 16:12 untitaker

@untitaker, thanks for the update. I'm going to add the synthetic, though, and I'm going to revisit if there are any other events for which we maybe should set this.

philipphofmann avatar Dec 06 '22 17:12 philipphofmann

This item came from @mitsuhiko and it was not related to NSError, I don't remember exactly which type of exceptions in Cocoa should be marked as synthetic tho.

marandaneto avatar Dec 06 '22 17:12 marandaneto

We didn't find any places to set the synthetic field in the SDK. MetricKit events will use the synthetic field. According to @mitsuhiko, grouping has room for improvement as we receive complaints about it through customer support regularly, which is unrelated to this issue.

philipphofmann avatar Jan 04 '23 13:01 philipphofmann