(parquetEvents []Event)
| 547 | } |
| 548 | |
| 549 | func parquetToProtoEvents(parquetEvents []Event) []*v1_trace.Span_Event { |
| 550 | var protoEvents []*v1_trace.Span_Event |
| 551 | |
| 552 | if len(parquetEvents) > 0 { |
| 553 | protoEvents = make([]*v1_trace.Span_Event, 0, len(parquetEvents)) |
| 554 | |
| 555 | for _, e := range parquetEvents { |
| 556 | |
| 557 | protoEvent := &v1_trace.Span_Event{ |
| 558 | TimeUnixNano: e.TimeUnixNano, |
| 559 | Name: e.Name, |
| 560 | Attributes: nil, |
| 561 | DroppedAttributesCount: uint32(e.DroppedAttributesCount), |
| 562 | } |
| 563 | |
| 564 | if len(e.Attrs) > 0 { |
| 565 | protoEvent.Attributes = make([]*v1.KeyValue, 0, len(e.Attrs)) |
| 566 | |
| 567 | for _, a := range e.Attrs { |
| 568 | protoAttr := &v1.KeyValue{ |
| 569 | Key: a.Key, |
| 570 | Value: &v1.AnyValue{}, |
| 571 | } |
| 572 | |
| 573 | // event attributes are currently encoded as proto, but were previously json. |
| 574 | // this code attempts proto first and, if there was an error, falls back to json |
| 575 | err := protoAttr.Value.Unmarshal(a.Value) |
| 576 | if err != nil { |
| 577 | _ = jsonpb.Unmarshal(bytes.NewBuffer(a.Value), protoAttr.Value) |
| 578 | } |
| 579 | |
| 580 | protoEvent.Attributes = append(protoEvent.Attributes, protoAttr) |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | protoEvents = append(protoEvents, protoEvent) |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | return protoEvents |
| 589 | } |
| 590 | |
| 591 | func ParquetTraceToTempopbTrace(meta *backend.BlockMeta, parquetTrace *Trace) *tempopb.Trace { |
| 592 | protoTrace := &tempopb.Trace{} |
no test coverage detected