toMap method

  1. @override
Map<String, dynamic> toMap()
override

Converts the event to a map with Datadog-specific formatting

Implementation

@override
Map<String, dynamic> toMap() {
  final map = super.toMap();

  if (tags != null && tags!.isNotEmpty) {
    map['tags'] = tags;
  }

  if (source != null) {
    map['source'] = source;
  }

  if (host != null) {
    map['host'] = host;
  }

  if (service != null) {
    map['service'] = service;
  }

  if (env != null) {
    map['env'] = env;
  }

  if (traceId != null) {
    map['trace_id'] = traceId;
  }

  if (spanId != null) {
    map['span_id'] = spanId;
  }

  if (attributes != null && attributes!.isNotEmpty) {
    map['attributes'] = attributes;
  }

  return map;
}