mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Service graphs: add dimensions and rename expired edges metric Add dimensions to the service graphs processor config, which attaches additional labels to the metrics from spans attributes. It also renames the expired edges internal metric. * Address comments
37 lines
945 B
Go
37 lines
945 B
Go
package util
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
v1common "github.com/grafana/tempo/pkg/tempopb/common/v1"
|
|
)
|
|
|
|
func StringifyAnyValue(anyValue *v1common.AnyValue) string {
|
|
switch anyValue.Value.(type) {
|
|
case *v1common.AnyValue_BoolValue:
|
|
return strconv.FormatBool(anyValue.GetBoolValue())
|
|
case *v1common.AnyValue_IntValue:
|
|
return strconv.FormatInt(anyValue.GetIntValue(), 10)
|
|
case *v1common.AnyValue_ArrayValue:
|
|
arrStr := "["
|
|
for _, v := range anyValue.GetArrayValue().Values {
|
|
arrStr += StringifyAnyValue(v)
|
|
}
|
|
arrStr += "]"
|
|
return arrStr
|
|
case *v1common.AnyValue_DoubleValue:
|
|
return strconv.FormatFloat(anyValue.GetDoubleValue(), 'f', -1, 64)
|
|
case *v1common.AnyValue_KvlistValue:
|
|
mapStr := "{"
|
|
for _, kv := range anyValue.GetKvlistValue().Values {
|
|
mapStr += kv.Key + ":" + StringifyAnyValue(kv.Value)
|
|
}
|
|
mapStr += "}"
|
|
return mapStr
|
|
case *v1common.AnyValue_StringValue:
|
|
return anyValue.GetStringValue()
|
|
}
|
|
|
|
return ""
|
|
}
|