DataDog / dd-sdk-ios

Datadog SDK for iOS - Swift and Objective-C.
Apache License 2.0
189 stars 121 forks source link

Associating attributes with WebView RUM #1104

Open kabiroberai opened 1 year ago

kabiroberai commented 1 year ago

At the moment, RUM events sent through the Web View bridge (i.e. web views configured with WKUserContentController.trackDatadogEvents) don't include attributes defined via Global.rum.addAttribute. This is somewhere in between a bug report and a feature request but it'd be great if the iOS RUM attributes could be combined with the browser RUM attributes. Without this in place, Datadog appears to non-deterministically(!) nuke iOS attributes from app sessions because it looks to be using a heuristic (last/most frequent view?) to determine which set of view attributes it should apply to the session as a whole.

I'm currently getting around this with a hacky redefinition of window.DatadogEventBridge.send but I have a feeling an in-tree fix could be a lot cleaner, by merging the browser and iOS attributes in DefaultWebRUMEventConsumer.map(event:with:).

maciejburda commented 1 year ago

Thanks for reporting this @kabiroberai. I will double check with the team and get back to you as soon as I can.