Skip to content

Commit

Permalink
Merge pull request #158 from atlassian/scale-0-metrics
Browse files Browse the repository at this point in the history
Emit 0 cpu/mem for scale up from 0
  • Loading branch information
Jacobious52 authored Apr 11, 2019
2 parents b50c6a9 + 52f582a commit 9b6d036
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,15 @@ func (c *Controller) scaleNodeGroup(nodegroup string, nodeGroup *NodeGroupState)

// Metrics
log.WithField("nodegroup", nodegroup).Infof("cpu: %v, memory: %v", cpuPercent, memPercent)
metrics.NodeGroupsCPUPercent.WithLabelValues(nodegroup).Set(cpuPercent)
metrics.NodeGroupsMemPercent.WithLabelValues(nodegroup).Set(memPercent)

// on the case that we're scaling up from 0, emit 0 as the metrics to keep metrics sane
if cpuPercent == math.MaxFloat64 || memPercent == math.MaxFloat64 {
metrics.NodeGroupsCPUPercent.WithLabelValues(nodegroup).Set(0)
metrics.NodeGroupsMemPercent.WithLabelValues(nodegroup).Set(0)
} else {
metrics.NodeGroupsCPUPercent.WithLabelValues(nodegroup).Set(cpuPercent)
metrics.NodeGroupsMemPercent.WithLabelValues(nodegroup).Set(memPercent)
}

locked := nodeGroup.scaleUpLock.locked()
if locked {
Expand Down

0 comments on commit 9b6d036

Please sign in to comment.