Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #17 from zumper/m.update_resource_usage_percent_ca…
Browse files Browse the repository at this point in the history
…lculation_for_autoscaling

Update resource usage calculation to multiply first and then divide
  • Loading branch information
jrasell authored Jul 27, 2019
2 parents 709c859 + d1caab4 commit 9dc3424
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/autoscale/autoscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (a *AutoScale) autoscaleJob(jobID string, policies map[string]*policy.Group
// Maths. Find the current CPU and memory utilisation in percentage based on the total
// available resources to the group, compared to their configured maximum based on the
// resource stanza.
cpuUsage := resourceUsage[group].cpu / resourceInfo[group].cpu * 100
memUsage := resourceUsage[group].mem / resourceInfo[group].mem * 100
cpuUsage := resourceUsage[group].cpu * 100 / resourceInfo[group].cpu
memUsage := resourceUsage[group].mem * 100 / resourceInfo[group].mem
a.logger.Debug().
Int("mem-usage-percentage", memUsage).
Int("cpu-usage-percentage", cpuUsage).
Expand Down

0 comments on commit 9dc3424

Please sign in to comment.