MCPcopy Create free account
hub / github.com/couchbase/cbft / convertStatName

Function convertStatName

ns_server.go:827–849  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

825}
826
827func convertStatName(key string) string {
828 lastSlash := strings.LastIndex(key, "/")
829 if lastSlash < 0 {
830 return "unknown"
831 }
832 statSuffix := key[lastSlash+1:]
833 if fixedStatName, ok := fixedSuffixToStatNameMapping[statSuffix]; ok {
834 return fixedStatName
835 }
836 statNameStart := strings.LastIndex(key[:lastSlash], "/")
837 if statNameStart < 0 {
838 return "unknown"
839 }
840 statPrefix := key[statNameStart+1 : lastSlash]
841 if statPrefix == "basic" {
842 statPrefix = ""
843 }
844 statName := camelToUnderscore(statSuffix)
845 if statPrefix != "" {
846 statName = camelToUnderscore(statPrefix) + "_" + statName
847 }
848 return statName
849}
850
851func camelToUnderscore(name string) string {
852 rv := ""

Callers 2

massageStatsFunction · 0.85
TestConvertStatNameFunction · 0.85

Calls 1

camelToUnderscoreFunction · 0.85

Tested by 1

TestConvertStatNameFunction · 0.68