Conversation
Adds two init options to the SDK configuration, both off by default: - sessionOnError keeps the sessions sessionSamplingRate leaves out, but only those that report an error. The native SDKs hold such a session in memory and upload its last minute when it reports one. - sessionReplayOnError does the same for the replays the Session Replay sample rate leaves out. Both sit on the SDK configuration rather than on SessionReplay.enable: on Android the replay switch belongs to the RUM configuration, built when the SDK starts, before Session Replay is enabled. On iOS it belongs to the Session Replay configuration, so the bridge keeps it and hands it over when Session Replay is enabled. Both are also read from datadog-configuration.json for native initialization. JS errors reach the native addError path, so they release a held session; an error dropped by errorEventMapper never reaches native code. On Android an error that error tracking also logs through DdLogs reaches RUM again from the native logger, which releases the session unless logEventMapper drops that log as well; the option's documentation says so. Needs native SDK releases that provide these options.
This branch has not been deployed
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.
Summary
Passes the native error-session capture switches through the React Native SDK.
DdSdkReactNativeConfigurationgainssessionOnErrorandsessionReplayOnError, both defaulting tofalse. They are also accepted in the partial config used byDatadogProviderand indatadog-configuration.json, including the schema.sessionOnError: sessions that the session sample rate does not pick are kept only if they report an error.sessionReplayOnError: the same for replays the replay sample rate does not pick.RUM.Configurationand handed toSessionReplay.Configurationwhen Session Replay is enabled.sessionReplayOnErrorlives on the SDK configuration rather than onSessionReplay.enable. On Android the switch is part of the RUM configuration, which is built before Session Replay is enabled.console.errorandDdRum.addErrorall reach the native error path, so they release a held session.errorEventMappernever reaches native code, so it does not release the session.DdLogs, and the native Android logger reports them to RUM asloggererrors. To keep such a session held on Android,logEventMapperhas to drop the log too. This is documented on the option.Testing
session_sample_rate0, and views carrysampled_for_error: true.errorEventMapperdrops the error: 0 RUM events on iOS. On Android it stays held only when the log is dropped too, as described above.