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

Function StringifyAnyValue

pkg/util/attributes.go:9–36  ·  view source on GitHub ↗
(anyValue *v1common.AnyValue)

Source from the content-addressed store, hash-verified

7)
8
9func StringifyAnyValue(anyValue *v1common.AnyValue) string {
10 switch anyValue.Value.(type) {
11 case *v1common.AnyValue_BoolValue:
12 return strconv.FormatBool(anyValue.GetBoolValue())
13 case *v1common.AnyValue_IntValue:
14 return strconv.FormatInt(anyValue.GetIntValue(), 10)
15 case *v1common.AnyValue_ArrayValue:
16 arrStr := "["
17 for _, v := range anyValue.GetArrayValue().Values {
18 arrStr += StringifyAnyValue(v)
19 }
20 arrStr += "]"
21 return arrStr
22 case *v1common.AnyValue_DoubleValue:
23 return strconv.FormatFloat(anyValue.GetDoubleValue(), 'f', -1, 64)
24 case *v1common.AnyValue_KvlistValue:
25 mapStr := "{"
26 for _, kv := range anyValue.GetKvlistValue().Values {
27 mapStr += kv.Key + ":" + StringifyAnyValue(kv.Value)
28 }
29 mapStr += "}"
30 return mapStr
31 case *v1common.AnyValue_StringValue:
32 return anyValue.GetStringValue()
33 }
34
35 return ""
36}

Callers 8

logSpansFunction · 0.92
logSpanFunction · 0.92
validateTraceSearchMethod · 0.92
logTraceAttributesMethod · 0.92
searchTagFunction · 0.92
searchTraceqlFunction · 0.92
queryMetricsFunction · 0.92
TestStringifyAnyValueFunction · 0.85

Calls 6

GetBoolValueMethod · 0.80
GetIntValueMethod · 0.80
GetArrayValueMethod · 0.80
GetDoubleValueMethod · 0.80
GetKvlistValueMethod · 0.80
GetStringValueMethod · 0.80

Tested by 1

TestStringifyAnyValueFunction · 0.68