Skip to content

Commit

Permalink
bins/<namespace name> command is removed from 7.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Nov 7, 2024
1 parent f558adf commit c22db49
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions info/as_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ const (
// 1. string values which are not commands
// 2. string values which are used to generate other commands
// 3. string values which are both command and constant
constStatXDR = "statistics/xdr" // StatXdr
constStatNS = "namespace/" // StatNamespace
constStatDCpre50 = "dc/" // statDC
constStatDC = "get-stats:context=xdr;dc="
constStatSet = "sets/" // StatSets
constStatBin = "bins/" // StatBins
constStatSIndex = "sindex/" // StatSindex
constStatNSNames = "namespaces" // StatNamespaces
constStatDCNames = "dcs" // StatDcs need dc names
constStatLogIDs = "logs" // StatLogs need logging id
constStatXDRpre50 = "statistics/xdr" // StatXdr
constStatNS = "namespace/" // StatNamespace
constStatDCpre50 = "dc/" // statDC
constStatDC = "get-stats:context=xdr;dc="
constStatSet = "sets/" // StatSets
constStatBin = "bins/" // StatBins
constStatSIndex = "sindex/" // StatSindex
constStatNSNames = "namespaces" // StatNamespaces
constStatDCNames = "dcs" // StatDcs need dc names
constStatLogIDs = "logs" // StatLogs need logging id

cmdConfigNetwork = "get-config:context=network" // ConfigNetwork
cmdConfigService = "get-config:context=service" // ConfigService
Expand Down Expand Up @@ -533,9 +533,13 @@ func (info *AsInfo) createStatCmdList(m map[string]string) []string {
for _, ns := range nsNames {
// namespace, sets, bins, sindex
cmdList = append(
cmdList, constStatNS+ns, constStatSet+ns, constStatBin+ns, constStatSIndex+ns,
cmdList, constStatNS+ns, constStatSet+ns, constStatSIndex+ns,
)

if r, _ := lib.CompareVersions(m[cmdMetaBuild], "7.0"); r == -1 {
cmdList = append(cmdList, constStatBin+ns)
}

indexNames := sindexNames(m[constStatSIndex], ns)
for _, index := range indexNames {
cmdList = append(cmdList, constStatSIndex+ns+"/"+index)
Expand Down Expand Up @@ -922,10 +926,13 @@ func parseStatInfo(rawMap map[string]string) lib.Stats {
statMap := make(lib.Stats)

statMap["service"] = parseBasicInfo(rawMap[ConstStat])
statMap["xdr"] = parseBasicInfo(rawMap[constStatXDR])
statMap["dc"] = parseAllDcStats(rawMap)
statMap["namespace"] = parseAllNsStats(rawMap)

if r, _ := lib.CompareVersions(rawMap[cmdMetaBuild], "5.0"); r == -1 {
statMap["xdr"] = parseBasicInfo(rawMap[constStatXDRpre50])
}

return statMap
}

Expand All @@ -951,7 +958,11 @@ func parseAllNsStats(rawMap map[string]string) lib.Stats {
m := make(lib.Stats)
m["service"] = parseStatNsInfo(rawMap[constStatNS+ns])
m["set"] = parseStatSetsInfo(rawMap[constStatSet+ns])
m["bin"] = parseStatBinsInfo(rawMap[constStatBin+ns])

if r, _ := lib.CompareVersions(rawMap[cmdMetaBuild], "7.0"); r == -1 {
m["bin"] = parseStatBinsInfo(rawMap[constStatBin+ns])
}

m["sindex"] = parseStatSindexsInfo(rawMap, ns)

nsStatMap[ns] = m
Expand Down

0 comments on commit c22db49

Please sign in to comment.