Skip to content

Commit

Permalink
Choose a metric with high resolution as 'base' metric
Browse files Browse the repository at this point in the history
This way if we discover the metrics have different resolutions, we'll
return the one containing (hopefully) the most information.  Note that
we still might have 'more' information (in terms of non-None data
points) if we chose a different metric instead.  Future work, I guess.

Updates issue #4.
  • Loading branch information
dgryski committed Oct 5, 2014
1 parent a926bc6 commit 444288c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,15 @@ func handleRenderPB(w http.ResponseWriter, req *http.Request, format string, res
return
}

// Use the metric with the highest resolution as our base
var highest int
for i, d := range decoded {
if d.GetStepTime() < decoded[highest].GetStepTime() {
highest = i
}
}
decoded[0], decoded[highest] = decoded[highest], decoded[0]

metric := decoded[0]

mergeValues(req, &metric, decoded)
Expand Down

0 comments on commit 444288c

Please sign in to comment.