Files
MarioandGitHub f87e304b60 Service graphs: add dimensions and rename expired edges metric (#1361)
* 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
2022-04-06 17:10:42 +03:00

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 ""
}