startAgent method
Implementation
Future<void> startAgent(Config config) async {
this.config = config;
FractalUp.configureHosted(
ingestionKey: config.accessToken,
endpoint: _requiredEndpoint(config.endpoint, 'config.endpoint'),
environmentName: _blankToNull(config.environment) ?? 'prod',
serviceName: config.serviceName,
sourceId: config.sourceId,
release: config.release,
appName: config.appName,
transportHeaders: config.transportHeaders,
requestHeadersProvider: config.requestHeadersProvider,
httpClient: config.httpClient,
persistQueuedEvents: config.offlineStorageEnabled,
offlineQueuePath: config.offlineQueuePath,
maxPersistedQueuedEvents: config.maxOfflineQueueEvents,
maxPersistedQueueBytes: config.maxOfflineQueueBytes,
firstPartyHosts: config.firstPartyHosts,
captureAppLifecycle:
config.backgroundReportingEnabled && config.lifecycleTrackingEnabled,
installErrorHooks: config.crashReportingEnabled,
);
FractalUp.setAttribute(
'mobile.analytics_enabled', config.analyticsEventEnabled);
FractalUp.setAttribute(
'mobile.network_enabled', config.networkRequestEnabled);
FractalUp.setAttribute(
'mobile.distributed_tracing_enabled',
config.distributedTracingEnabled,
);
FractalUp.setAttribute('mobile.logging_enabled', config.loggingEnabled);
FractalUp.setAttribute(
'mobile.http_instrumentation_enabled',
config.httpInstrumentationEnabled,
);
FractalUp.setAttribute(
'mobile.webview_instrumentation_enabled',
config.webViewInstrumentation,
);
if (config.printStatementAsEventsEnabled) {
redirectDebugPrint();
}
if (config.httpInstrumentationEnabled) {
compat_http.installGlobalHttpInstrumentation();
}
}