DatadogConfiguration constructor

DatadogConfiguration({
  1. required String clientToken,
  2. required String env,
  3. required DatadogSite site,
  4. bool nativeCrashReportEnabled = false,
  5. String? service,
  6. UploadFrequency? uploadFrequency,
  7. BatchSize? batchSize,
  8. BatchProcessingLevel? batchProcessingLevel,
  9. String? version,
  10. String? flavor,
  11. List<String>? firstPartyHosts,
  12. Map<String, Set<TracingHeaderType>> firstPartyHostsWithTracingHeaders = const {},
  13. DatadogLoggingConfiguration? loggingConfiguration,
  14. DatadogRumConfiguration? rumConfiguration,
})

Implementation

DatadogConfiguration({
  required this.clientToken,
  required this.env,
  required this.site,
  this.nativeCrashReportEnabled = false,
  this.service,
  this.uploadFrequency,
  this.batchSize,
  this.batchProcessingLevel,
  this.version,
  this.flavor,
  List<String>? firstPartyHosts,
  this.firstPartyHostsWithTracingHeaders = const {},
  this.loggingConfiguration,
  this.rumConfiguration,
}) {
  // Attempt a union if both configuration options are present
  if (firstPartyHosts != null) {
    // make map mutable in case it's the default
    firstPartyHostsWithTracingHeaders =
        Map<String, Set<TracingHeaderType>>.from(
            firstPartyHostsWithTracingHeaders);

    for (var entry in firstPartyHosts) {
      final headerTypes = firstPartyHostsWithTracingHeaders[entry];
      if (headerTypes == null) {
        firstPartyHostsWithTracingHeaders[entry] = {
          TracingHeaderType.datadog,
          TracingHeaderType.tracecontext,
        };
      } else {
        headerTypes.add(TracingHeaderType.datadog);
        headerTypes.add(TracingHeaderType.tracecontext);
      }
    }
  }
}