optimize BuildFQName function
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
parent
aef8aedb4b
commit
ece74f8b01
|
@ -108,15 +108,23 @@ func BuildFQName(namespace, subsystem, name string) string {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
switch {
|
|
||||||
case namespace != "" && subsystem != "":
|
sb := strings.Builder{}
|
||||||
return strings.Join([]string{namespace, subsystem, name}, "_")
|
sb.Grow(len(namespace) + len(subsystem) + len(name) + 2)
|
||||||
case namespace != "":
|
|
||||||
return strings.Join([]string{namespace, name}, "_")
|
if namespace != "" {
|
||||||
case subsystem != "":
|
sb.WriteString(namespace)
|
||||||
return strings.Join([]string{subsystem, name}, "_")
|
sb.WriteString("_")
|
||||||
}
|
}
|
||||||
return name
|
|
||||||
|
if subsystem != "" {
|
||||||
|
sb.WriteString(subsystem)
|
||||||
|
sb.WriteString("_")
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.WriteString(name)
|
||||||
|
|
||||||
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
type invalidMetric struct {
|
type invalidMetric struct {
|
||||||
|
|
Loading…
Reference in New Issue