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

Function attrToParquet

tempodb/encoding/vparquet3/schema.go:238–265  ·  view source on GitHub ↗
(a *v1.KeyValue, p *Attribute)

Source from the content-addressed store, hash-verified

236}
237
238func attrToParquet(a *v1.KeyValue, p *Attribute) {
239 p.Key = a.Key
240 p.Value = nil
241 p.ValueArray = ""
242 p.ValueBool = nil
243 p.ValueDouble = nil
244 p.ValueInt = nil
245 p.ValueKVList = ""
246
247 switch v := a.GetValue().Value.(type) {
248 case *v1.AnyValue_StringValue:
249 p.Value = &v.StringValue
250 case *v1.AnyValue_IntValue:
251 p.ValueInt = &v.IntValue
252 case *v1.AnyValue_DoubleValue:
253 p.ValueDouble = &v.DoubleValue
254 case *v1.AnyValue_BoolValue:
255 p.ValueBool = &v.BoolValue
256 case *v1.AnyValue_ArrayValue:
257 jsonBytes := &bytes.Buffer{}
258 _ = jsonMarshaler.Marshal(jsonBytes, a.Value) // deliberately marshalling a.Value because of AnyValue logic
259 p.ValueArray = jsonBytes.String()
260 case *v1.AnyValue_KvlistValue:
261 jsonBytes := &bytes.Buffer{}
262 _ = jsonMarshaler.Marshal(jsonBytes, a.Value) // deliberately marshalling a.Value because of AnyValue logic
263 p.ValueKVList = jsonBytes.String()
264 }
265}
266
267// traceToParquet converts a tempopb.Trace to this schema's object model. Returns the new object and
268// a bool indicating if it's a connected trace or not

Callers 1

traceToParquetFunction · 0.70

Calls 3

MarshalMethod · 0.65
GetValueMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected