generateDatadogAttributes function
Implementation
Map<String, Object?> generateDatadogAttributes(
TracingContext? context,
double samplingRate,
) {
var attributes = <String, Object?>{};
if (context != null) {
attributes[DatadogRumPlatformAttributeKey.rulePsr] = samplingRate / 100.0;
if (context.sampled) {
attributes[DatadogRumPlatformAttributeKey.traceID] = context.traceId
.asString(TracingIdRepresentation.hex32Chars);
attributes[DatadogRumPlatformAttributeKey.spanID] = context.spanId
.asString(TracingIdRepresentation.decimal);
}
}
return attributes;
}