ReadOnlySpan.fromJson constructor

ReadOnlySpan.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ReadOnlySpan.fromJson(Map<String, dynamic> json) {
  return ReadOnlySpanImpl(
    name: json['name'],
    kind: api.SpanKind.values.firstWhere((e) => e.toString() == json['kind']),
    spanContext: api.SpanContext.fromJson(json['spanContext']),
    parentSpanId: api.SpanId.fromJson(json['parentSpanId']),
    startTime: Int64.parseInt(json['startTime']),
    endTime: json['endTime'] != null ? Int64.parseInt(json['endTime']) : null,
    status: api.SpanStatus.fromJson(json['status']),
    events: (json['events'] as List)
        .map((e) => api.SpanEvent.fromJson(e))
        .toList(),
    droppedEventsCount: json['droppedEventsCount'],
    instrumentationScope:
        sdk.InstrumentationScope.fromJson(json['instrumentationScope']),
    links:
        (json['links'] as List).map((l) => api.SpanLink.fromJson(l)).toList(),
    droppedLinksCount: json['droppedLinksCount'],
    attributes: Attributes.fromJson(json['attributes']),
    droppedAttributes: json['droppedAttributes'],
    resource: sdk.Resource.fromJson(json['resource']),
  );
}