Skip to content

Commit

Permalink
up cli
Browse files Browse the repository at this point in the history
* compile with extended FSHC config
* support per-backend metrics ('get-cold' removed)

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jul 18, 2024
1 parent aaec09d commit 4432425
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 27 deletions.
18 changes: 9 additions & 9 deletions cmd/cli/cli/completions.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ var (
supportedBool = []string{"true", "false"}
propCmpls = map[string][]string{
// log modules
confLogModules: append(cos.Smodules, apc.NilValue),
confLogModules: append(cos.Smodules[:], apc.NilValue),
// checksums
apc.HdrObjCksumType: cos.SupportedChecksums(),
// access
cmn.PropBucketAccessAttrs: apc.SupportedPermissions(),
// feature flags
"cluster.features": append(feat.Cluster, apc.NilValue),
"bucket.features": append(feat.Bucket, apc.NilValue),
"cluster.features": append(feat.Cluster[:], apc.NilValue),
"bucket.features": append(feat.Bucket[:], apc.NilValue),
// rest
"write_policy.data": apc.SupportedWritePolicy,
"write_policy.md": apc.SupportedWritePolicy,
"ec.compression": apc.SupportedCompression,
"compression.checksum": apc.SupportedCompression,
"rebalance.compression": apc.SupportedCompression,
"distributed_sort.compression": apc.SupportedCompression,
"write_policy.data": apc.SupportedWritePolicy[:],
"write_policy.md": apc.SupportedWritePolicy[:],
"ec.compression": apc.SupportedCompression[:],
"compression.checksum": apc.SupportedCompression[:],
"rebalance.compression": apc.SupportedCompression[:],
"distributed_sort.compression": apc.SupportedCompression[:],
"distributed_sort.duplicated_records": cmn.SupportedReactions,
"distributed_sort.ekm_malformed_line": cmn.SupportedReactions,
"distributed_sort.ekm_missing_key": cmn.SupportedReactions,
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/cli/config_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func setCluConfigHandler(c *cli.Context) error {

// assorted named fields that require (cluster | node) restart
// for the change to take an effect
if name := nvs.ContainsAnyMatch(cmn.ConfigRestartRequired); name != "" {
if name := nvs.ContainsAnyMatch(cmn.ConfigRestartRequired[:]); name != "" {
warn := fmt.Sprintf("cluster restart required for the change '%s=%s' to take an effect.", name, nvs[name])
actionWarn(c, warn)
}
Expand Down Expand Up @@ -355,7 +355,7 @@ func setNodeConfigHandler(c *cli.Context) error {

// assorted named fields that'll require (cluster | node) restart
// for the change to take an effect
if name := nvs.ContainsAnyMatch(cmn.ConfigRestartRequired); name != "" {
if name := nvs.ContainsAnyMatch(cmn.ConfigRestartRequired[:]); name != "" {
warn := fmt.Sprintf("for the change '%s=%s' to take an effect node %q must be restarted.",
name, nvs[name], sname)
actionWarn(c, warn)
Expand Down
47 changes: 34 additions & 13 deletions cmd/cli/cli/performance.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ type (
metrics cos.StrKVs, mapBegin, mapEnd teb.StstMap, elapsed time.Duration) bool
)

// _statically_ defined addition for the `latency` table (compare with counter and throughput tabs)
var addLatencyTab = []string{
stats.GetSize, stats.GetCount, stats.GetColdCount, stats.GetColdSize,
stats.PutSize, stats.PutCount,
stats.AppendCount,
}

// true when called by top-level handler
var allPerfTabs bool

Expand Down Expand Up @@ -176,14 +169,20 @@ func showThroughputHandler(c *cli.Context) error {

selected := make(cos.StrKVs, len(metrics))
for name, kind := range metrics {
switch name {
case stats.GetSize, stats.GetCount, stats.PutSize, stats.PutCount:
selected[name] = kind
continue
}

switch {
case kind == stats.KindThroughput:
// 1. all throughput
selected[name] = kind
totals[name] = 0
case name == stats.GetSize || name == stats.GetColdSize || name == stats.PutSize ||
name == stats.GetCount || name == stats.GetColdCount || name == stats.PutCount:
// 2. to show average get/put sizes
case strings.HasSuffix(name, "."+stats.GetCount) || strings.HasSuffix(name, "."+stats.GetSize):
selected[name] = kind
case strings.HasSuffix(name, "."+stats.PutCount) || strings.HasSuffix(name, "."+stats.PutSize):
selected[name] = kind
case stats.IsErrMetric(name):
// 3. errors
Expand Down Expand Up @@ -231,6 +230,8 @@ func _throughput(c *cli.Context, metrics cos.StrKVs, mapBegin, mapEnd teb.StstMa
return
}

// TODO -- FIXME: transition to using totals (ais/backend/common.go)

// NOTE: two built-in assumptions: one cosmetic, another major
// - ".ns" => ".n" correspondence is the cosmetic one
// - the naive way to recompute latency using the total elapsed, not the actual, time to execute so many requests...
Expand All @@ -243,10 +244,18 @@ func showLatencyHandler(c *cli.Context) error {
_warnThruLatIters(c)

// statically filter metrics (names)
selected := make(cos.StrKVs, 20)
selected := make(cos.StrKVs, len(metrics))
for name, kind := range metrics {
switch name {
case stats.GetSize, stats.GetCount, stats.PutSize, stats.PutCount, stats.AppendCount:
selected[name] = kind
continue
}

switch {
case cos.StringInSlice(name, addLatencyTab):
case strings.HasSuffix(name, "."+stats.GetCount) || strings.HasSuffix(name, "."+stats.GetSize):
selected[name] = kind
case strings.HasSuffix(name, "."+stats.PutCount) || strings.HasSuffix(name, "."+stats.PutSize):
selected[name] = kind
case strings.HasSuffix(name, ".ns") && name != stats.Uptime: // NOTE: not including and not handling "*.ns.total"
selected[name] = kind
Expand Down Expand Up @@ -279,8 +288,20 @@ func _latency(c *cli.Context, metrics cos.StrKVs, mapBegin, mapEnd teb.StstMap,
switch name {
case stats.GetLatency, stats.GetRedirLatency:
ncounter = stats.GetCount

// TODO -- FIXME: transition to using totals (ais/backend/common.go)
case stats.GetColdRwLatency:
ncounter = stats.GetColdCount
if _, ok := metrics["aws."+stats.GetCount]; ok {
ncounter = "aws." + stats.GetCount
} else if _, ok := metrics["gcp."+stats.GetCount]; ok {
ncounter = "gcp." + stats.GetCount
} else if _, ok := metrics["azure."+stats.GetCount]; ok {
ncounter = "azure." + stats.GetCount
} else {
v.Value = 0
begin.Tracker[name] = v
continue
}
case stats.PutLatency, stats.PutRedirLatency:
ncounter = stats.PutCount
case stats.AppendLatency:
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/cli
go 1.22.3

require (
github.com/NVIDIA/aistore v1.3.24-0.20240707182232-e2a68fa77664
github.com/NVIDIA/aistore v1.3.24-0.20240718165219-43d88d22ae8c
github.com/fatih/color v1.17.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.19.0
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/NVIDIA/aistore v1.3.24-0.20240707182232-e2a68fa77664 h1:1N8u8C8ImaYqNxcZoQc/By8OOn3fR11Wx2B/f1gcyHM=
github.com/NVIDIA/aistore v1.3.24-0.20240707182232-e2a68fa77664/go.mod h1:rzuE/hzSFxylpF5sfawzy1DPnkmWchiW11nb1omitq8=
github.com/NVIDIA/aistore v1.3.24-0.20240718165219-43d88d22ae8c h1:BfvTrTnUfpgtJqWmXUxpQ6yOSgqCsVKCIlvgUf9x9YI=
github.com/NVIDIA/aistore v1.3.24-0.20240718165219-43d88d22ae8c/go.mod h1:A4wCIW7GooZSzDxTxh4pS092Ve9gCiXh1EvtjlVB8ew=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
Expand Down

0 comments on commit 4432425

Please sign in to comment.