MCPcopy
hub / github.com/grafana/tempo / parquetToProtoAttrs

Function parquetToProtoAttrs

tempodb/encoding/vparquet3/schema.go:511–547  ·  view source on GitHub ↗
(parquetAttrs []Attribute)

Source from the content-addressed store, hash-verified

509}
510
511func parquetToProtoAttrs(parquetAttrs []Attribute) []*v1.KeyValue {
512 var protoAttrs []*v1.KeyValue
513
514 for _, attr := range parquetAttrs {
515 protoVal := &v1.AnyValue{}
516
517 switch {
518 case attr.Value != nil:
519 protoVal.Value = &v1.AnyValue_StringValue{
520 StringValue: *attr.Value,
521 }
522 case attr.ValueInt != nil:
523 protoVal.Value = &v1.AnyValue_IntValue{
524 IntValue: *attr.ValueInt,
525 }
526 case attr.ValueDouble != nil:
527 protoVal.Value = &v1.AnyValue_DoubleValue{
528 DoubleValue: *attr.ValueDouble,
529 }
530 case attr.ValueBool != nil:
531 protoVal.Value = &v1.AnyValue_BoolValue{
532 BoolValue: *attr.ValueBool,
533 }
534 case attr.ValueArray != "":
535 _ = jsonpb.Unmarshal(bytes.NewBufferString(attr.ValueArray), protoVal)
536 case attr.ValueKVList != "":
537 _ = jsonpb.Unmarshal(bytes.NewBufferString(attr.ValueKVList), protoVal)
538 }
539
540 protoAttrs = append(protoAttrs, &v1.KeyValue{
541 Key: attr.Key,
542 Value: protoVal,
543 })
544 }
545
546 return protoAttrs
547}
548
549func parquetToProtoEvents(parquetEvents []Event) []*v1_trace.Span_Event {
550 var protoEvents []*v1_trace.Span_Event

Callers 1

Calls 1

UnmarshalMethod · 0.65

Tested by

no test coverage detected