Skip to content

Commit

Permalink
OM-209 - review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mphanias committed Oct 29, 2024
1 parent 731f66f commit d538129
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
29 changes: 13 additions & 16 deletions internal/pkg/statprocessors/sp_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,23 @@ func (lw *LatencyStatsProcessor) getLatenciesCommands(rawMetrics map[string]stri
// re-repl is auto-enabled, but not coming as part of latencies: list, hence we are adding it explicitly
//
// Hashmap content format := namespace-<histogram-key> = <0/1>
for latencyHistName := range LatencyBenchmarks {
nsName := strings.Split(latencyHistName, "~")[0]
stat := LatencyBenchmarks[latencyHistName]
for nsName, nsLatencies := range NamespaceLatencyBenchmarks {

histCommand := "latencies:hist="
for stat := range nsLatencies {
histCommand := "latencies:hist="

// service-enable-benchmarks-fabric or ns-enable-benchmarks-ops-sub or service-enable-hist-info or service-enable-hist-proxy
if nsName != "service" {
// service-enable-benchmarks-fabric or ns-enable-benchmarks-ops-sub or service-enable-hist-info or service-enable-hist-proxy
histCommand = histCommand + "{" + nsName + "}-"
}
if strings.Contains(stat, "enable-") {
stat = strings.ReplaceAll(stat, "enable-", "")
}
if strings.Contains(stat, "hist-") {
stat = strings.ReplaceAll(stat, "hist-", "")
}

histCommand = histCommand + stat
if strings.Contains(stat, "enable-") {
stat = strings.ReplaceAll(stat, "enable-", "")
}
if strings.Contains(stat, "hist-") {
stat = strings.ReplaceAll(stat, "hist-", "")
}

commands = append(commands, histCommand)
histCommand = histCommand + stat
commands = append(commands, histCommand)
}
}

log.Tracef("latency-getLatenciesCommands:%s", commands)
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/statprocessors/sp_namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,16 @@ func (nw *NamespaceStatsProcessor) refreshNamespaceStats(singleInfoKey string, i
// check and if latency benchmarks stat - is it enabled (bool true==1 and false==0 after conversion)
if isStatLatencyHistRelated(stat) {
// remove old value as microbenchmark may get enabled / disable on-the-fly at server so we cannot rely on value
delete(LatencyBenchmarks, nsName+"~"+stat)
delete(NamespaceLatencyBenchmarks[nsName], stat)

if pv == 1 {
LatencyBenchmarks[nsName+"~"+stat] = stat
NamespaceLatencyBenchmarks[nsName][stat] = stat
}
}

}
// append default re-repl, as this auto-enabled, but not coming as part of latencies, we need this as namespace is available only here
LatencyBenchmarks[nsName+"~latency-hist-re-repl"] = "re-repl"
NamespaceLatencyBenchmarks[nsName]["re-repl"] = "re-repl"

return nsMetricsToSend
}
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/statprocessors/sp_node_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ func (sw *NodeStatsProcessor) handleRefresh(nodeRawMetrics string) []AerospikeSt
if isStatLatencyHistRelated(stat) {

// remove old value as microbenchmark may get enabled / disable on-the-fly at server so we cannot rely on value
delete(LatencyBenchmarks, "service~"+stat)
delete(NodeLatencyBenchmarks, stat)

if pv == 1 {
LatencyBenchmarks["service~"+stat] = stat
NodeLatencyBenchmarks[stat] = stat
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/statprocessors/statsprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var (
Service, ClusterName, Build string
)

var LatencyBenchmarks = make(map[string]string)
var NodeLatencyBenchmarks = make(map[string]string)
var NamespaceLatencyBenchmarks = make(map[string]map[string]string)

type StatProcessor interface {
PassOneKeys() []string
Expand Down

0 comments on commit d538129

Please sign in to comment.