Skip to content

Commit

Permalink
base load graph x-axis on data, not a hardcoded window
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbellamy committed Nov 11, 2015
1 parent c08fd20 commit 3b3a45c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions render/detailed_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"sort"
"strconv"
"time"

"github.com/weaveworks/scope/probe/docker"
"github.com/weaveworks/scope/probe/host"
Expand Down Expand Up @@ -496,10 +495,7 @@ func getDockerLabelRows(nmd report.Node) []Row {

func hostOriginTable(nmd report.Node) (Table, bool) {
// Ensure that all metrics have the same max
var (
maxLoad = 0.0
lastLoad time.Time
)
maxLoad := 0.0
for _, key := range []string{host.Load1, host.Load5, host.Load15} {
if metric, ok := nmd.Metrics[key]; ok {
if metric.Len() == 0 {
Expand All @@ -508,9 +504,6 @@ func hostOriginTable(nmd report.Node) (Table, bool) {
if metric.Max > maxLoad {
maxLoad = metric.Max
}
if lastLoad.IsZero() || metric.Last.After(lastLoad) {
lastLoad = metric.Last
}
}
}

Expand All @@ -522,8 +515,6 @@ func hostOriginTable(nmd report.Node) (Table, bool) {
} {
if val, ok := nmd.Metrics[tuple.key]; ok {
val.Max = maxLoad
val.First = lastLoad.Add(-15 * time.Second) // TODO(paulbellamy): This should be based on the duration flag, maybe? or just auto-scale to data.
val.Last = lastLoad
rows = append(rows, sparklineRow(tuple.human, val, nil))
}
}
Expand Down

0 comments on commit 3b3a45c

Please sign in to comment.