[iOS] Drop network error events of resources marked as dropped (#1338)#1339
Draft
LinFeiLong wants to merge 1 commit into
Draft
[iOS] Drop network error events of resources marked as dropped (#1338)#1339LinFeiLong wants to merge 1 commit into
LinFeiLong wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Registers the missing native
errorEventMapperinDdSdkNativeInitialization.swift, mirroring the existingresourceEventMapperandactionEventMapper: RUM error events whose context carries the internal_dd.resource.drop_resourcemarker are dropped before being sent to Datadog.Adds
RUMErrorEventmocks and atestDropsErrorMarkedAsDroppedunit 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
URLSessioninstrumentation; the duplicated resource and action events are dropped via thedrop_resourcemarker, but the error events emitted for the same failed requests are not — they always reach Datadog and cannot be filtered from application code (the JSerrorEventMappernever 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
patch-packagepatch on@datadog/mobile-react-native@3.4.0: it builds and removes exactly the marked duplicates; error events from natively-issued requests (no JS mirror, no marker) are untouched.