DatadogAttachConfiguration constructor

DatadogAttachConfiguration({
  1. bool detectLongTasks = true,
  2. double longTaskThreshold = 0.1,
  3. double traceSampleRate = 20.0,
  4. bool reportFlutterPerformance = false,
  5. List<String>? firstPartyHosts,
  6. Map<String, Set<TracingHeaderType>> firstPartyHostsWithTracingHeaders = const {},
})

Implementation

DatadogAttachConfiguration({
  this.detectLongTasks = true,
  this.longTaskThreshold = 0.1,
  this.traceSampleRate = 20.0,
  this.reportFlutterPerformance = false,
  List<String>? firstPartyHosts,
  this.firstPartyHostsWithTracingHeaders = const {},
}) {
  // Attempt a union if both configuration options are present
  if (firstPartyHosts != null) {
    // make map mutable
    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);
      }
    }
  }
}