Under certain circumstances, Flutter can create two FlutterEngines which each have their own method channels. If this happens, we could end up in a situation where RUM and Logs were not properly attached to a MethodChannel, resulting in error messages and lost calls.
refs: #596 #580 RUM-491 RUM-4438
How?
We're removing the DatadogRumPlugin and DatadogLogsPlugin singletons and replacing them with instances to avoid this. Both plugins will attach to existing Datadog Logs and RUM instances during initialization if they have already been inititalized.
However, this breaks our current mapper implementation. Since Datadog expects the mapper during initialization, and holds it during the life of the application, we have to move the mappers to a companion object of the *Plugin classes to avoid issues with multiple or disconnected MethodChannels.
This potentially also helps us with multiple isolate tracking, but is just the first step of that.
Review checklist
[ ] This pull request has appropriate unit and / or integration tests
[ ] This pull request references a Github or JIRA issue
What and why?
Under certain circumstances, Flutter can create two FlutterEngines which each have their own method channels. If this happens, we could end up in a situation where RUM and Logs were not properly attached to a MethodChannel, resulting in error messages and lost calls.
refs: #596 #580 RUM-491 RUM-4438
How?
We're removing the
DatadogRumPlugin
andDatadogLogsPlugin
singletons and replacing them with instances to avoid this. Both plugins will attach to existing Datadog Logs and RUM instances during initialization if they have already been inititalized.However, this breaks our current mapper implementation. Since Datadog expects the mapper during initialization, and holds it during the life of the application, we have to move the mappers to a companion object of the
*Plugin
classes to avoid issues with multiple or disconnectedMethodChannels
.This potentially also helps us with multiple isolate tracking, but is just the first step of that.
Review checklist