Skip to content

[iOS] Drop network error events of resources marked as dropped (#1338)#1339

Draft
LinFeiLong wants to merge 1 commit into
DataDog:developfrom
LinFeiLong:feat/ios-drop-network-errors-of-dropped-resources
Draft

[iOS] Drop network error events of resources marked as dropped (#1338)#1339
LinFeiLong wants to merge 1 commit into
DataDog:developfrom
LinFeiLong:feat/ios-drop-network-errors-of-dropped-resources

Conversation

@LinFeiLong

Copy link
Copy Markdown

What does this PR do?

Registers the missing native errorEventMapper in DdSdkNativeInitialization.swift, mirroring the existing resourceEventMapper and actionEventMapper: RUM error events whose context carries the internal _dd.resource.drop_resource marker are dropped before being sent to Datadog.

Adds RUMErrorEvent mocks and a testDropsErrorMarkedAsDropped unit test, mirroring the existing resource/action mapper tests.

Motivation

Implements the proposal discussed in #1338. On iOS, requests tracked by the JS layer are tracked a second time by the native URLSession instrumentation; the duplicated resource and action events are dropped via the drop_resource marker, but the error events emitted for the same failed requests are not — they always reach Datadog and cannot be filtered from application code (the JS errorEventMapper never sees them, and no native hook is exposed). In our production app this represents ~583k duplicated error events per month.

This change aligns iOS with the current Android behavior, where JS-tracked requests produce no native error events. The failure information is preserved: the JS layer still reports the resource with status_code: 0.

Additional Notes

…og#1338)

On iOS, requests tracked by the JS layer are marked with the
_dd.resource.drop_resource attribute so the native resourceEventMapper
and actionEventMapper drop the duplicated native events. Error events
emitted for the same failed requests carry the marker too but no
errorEventMapper was registered, so they always reached Datadog and
could not be filtered from application code. Register the missing
mapper, mirroring the two existing ones, aligning iOS with the Android
behavior where JS-tracked requests produce no native error events.

Fixes DataDog#1338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant