github.com/MetalBlockchain/metalgo@v1.11.9/utils/metric/namespace.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package metric 5 6 import "strings" 7 8 const ( 9 NamespaceSeparatorByte = '_' 10 NamespaceSeparator = string(NamespaceSeparatorByte) 11 ) 12 13 func AppendNamespace(prefix, suffix string) string { 14 switch { 15 case len(prefix) == 0: 16 return suffix 17 case len(suffix) == 0: 18 return prefix 19 default: 20 return strings.Join([]string{prefix, suffix}, NamespaceSeparator) 21 } 22 }