bugsnag / bugsnag-cocoa

BugSnag error monitoring & exception reporter for iOS, macOS, tvOS and watchOS
https://docs.bugsnag.com/platforms/ios
MIT License
234 stars 128 forks source link

[Plat-12123] trace id in errors #1649

Closed kstenerud closed 3 months ago

kstenerud commented 3 months ago

Goal

Add the current trace and span IDs to errors whenever possible.

It must work (i.e. not crash):

Design

Use bugsnag-cocoa-performance cross-talk API to fetch the current trace ID and span ID whenever an error occurs and we are in an environment that doesn't restrict us to async-safe calls.

This information (when available) is added to a new top-level "correlation" field in the event:

"correlation": {
    "spanid": "84fe24c394f0b2fd",
    "traceid": "762ad72e35102a516a8f20895f9770a4"
}

Testing

New unit tests for the cross-talk bridge. Manual testing in an app with bugsnag-cocoa-performance linked, and not linked.

github-actions[bot] commented 3 months ago

Bugsnag.framework binary size increased by 4,784 bytes from 713,392 to 718,176

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.8% +2.89Ki  +1.8% +2.89Ki    String Table
  +1.4% +1.72Ki  +1.4% +1.72Ki    Symbol Table
  +0.7% +1.63Ki  +0.7% +1.63Ki    __TEXT,__text
  +2.0%    +776  +2.0%    +776    __DATA,__objc_const
  +1.7%    +319  +1.7%    +319    __TEXT,__objc_methname
  +1.3%    +256  +1.3%    +256    __DATA,__cfstring
  +1.0%    +183  +1.0%    +183    __TEXT,__cstring
  +4.5%    +160  +4.5%    +160    __DATA,__objc_data
  +1.7%     +80  +1.7%     +80    __DATA,__objc_selrefs
  +5.5%     +59  +5.5%     +59    __TEXT,__objc_classname
  +1.8%     +36  +1.8%     +36    __TEXT,__objc_methtype
  +1.8%     +32  +1.8%     +32    Rebase Info
  +1.0%     +32  +1.0%     +32    __TEXT,__unwind_info
  +1.7%     +20  +0.3%     +28    [3 Others]
  +0.6%     +16  +0.6%     +16    Binding Info
  +1.0%     +16  +1.0%     +16    Function Start Addresses
  +4.5%     +16  +4.5%     +16    __DATA,__objc_classlist
  +2.4%     +16  +2.4%     +16    __DATA,__objc_classrefs
 -19.5% -1.29Ki -10.0% -1.30Ki    [__DATA]
 -12.2% -2.24Ki -12.2% -2.24Ki    [__TEXT]
  [ = ]       0 -63.8% -4.67Ki    [__LINKEDIT]
  +0.7% +4.67Ki  [ = ]       0    TOTAL

Generated by :no_entry_sign: Danger