Skip to content

Commit

Permalink
minbucket fix, was comparing against value instead of key
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Autin committed Aug 16, 2019
1 parent 2a1653f commit c17bfc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

var (
listenPort = flag.String("listenPort", ":9634", "listen address for prometheus")
nodeAddr = flag.String("node", "127.0.0.1", "aerospike node")
skipNodeCheck = flag.Bool("skipNodeCheck", false, "Used only for testing local code development. Do not use in production.")
nodeAddr = flag.String("nodeAddr", "127.0.0.1", "aerospike node")
namespaceSets = flag.String("namespaceSets", "", "namespace:set comma delimited. Ex: 'myns:myset,myns2:myset3,myns3:,myns4:'- set optional, but colon is not")
failOnClusterChange = flag.Bool("failOnClusterChange", false, "should we abort the scan on cluster change?")
reportCount = flag.Int("reportCount", 300000, "How many records should be report on? Every <x> records will cause an entry in the stdout")
Expand Down Expand Up @@ -91,6 +92,7 @@ func init() {
"-exportType": *exportType,
"-exportTypeDivision": *exportTypeDivision,
"-exportBucketMultiply": *exportBucketMultiply,
"-skipNodeCheck:": *skipNodeCheck,
}).Info("Showing passable parameters and their current values.")

if *namespaceSets == "" {
Expand Down
9 changes: 8 additions & 1 deletion stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func getLocalNode() *as.Node {
log.Debug("Fetching membership list..")
nodes := client.GetNodes()
log.Debug("Looping through active cluster nodes")
if *skipNodeCheck {
return nodes[0]
}
for _, node := range nodes {
// convert the node to a string, then split that to find the addr

Expand Down Expand Up @@ -169,8 +172,12 @@ func updateStats(namespace string, set string, namespaceSet string) string {
var minBucket uint32
for key := range resultMap[namespaceSet] {
skey := fmt.Sprint(key)
if minBucket == 0 || (key < minBucket && resultMap[namespaceSet][key] > 0) {
log.Debug("Checking to see if ", key, " should be our minBucket.")
if minBucket == 0 || (key < minBucket && key > 0) {
minBucket = key
log.Debug("Setting minBucket to ", key)
} else {
log.Debug("minBucket is not ", key)
}
if *exportPercentages {
percentInThisBucket := float64(resultMap[namespaceSet][key]) * float64(100) / float64(total)
Expand Down

0 comments on commit c17bfc2

Please sign in to comment.