Fixups for single-op-per-fingerprint view rendering.

Change-Id: Ie496d4529b65a3819c6042f43d7cf99e0e1ac60b
This commit is contained in:
Julius Volz 2014-03-07 00:54:28 +01:00
parent 8b43497002
commit 5745ce0a60
2 changed files with 73 additions and 64 deletions

View file

@ -15,6 +15,7 @@ package metric
import (
"time"
"github.com/prometheus/prometheus/utility"
clientmodel "github.com/prometheus/client_golang/model"
@ -93,6 +94,7 @@ func (l *valueAtTimeList) Get(fp *clientmodel.Fingerprint, time clientmodel.Time
}
op.fp = *fp
op.current = time
op.consumed = false
return op
}

View file

@ -434,6 +434,7 @@ func (t *TieredStorage) renderView(viewJob viewJob) {
memValues := t.memoryArena.CloneSamples(fp)
for !op.Consumed() {
// Abort the view rendering if the caller (MakeView) has timed out.
if len(viewJob.abort) > 0 {
return
@ -504,7 +505,7 @@ func (t *TieredStorage) renderView(viewJob viewJob) {
// There's no data at all for this fingerprint, so stop processing.
if len(currentChunk) == 0 {
continue
break
}
currentChunk = currentChunk.TruncateBefore(targetTime)
@ -514,12 +515,18 @@ func (t *TieredStorage) renderView(viewJob viewJob) {
targetTime = lastChunkTime
}
if op.CurrentTime().After(targetTime) {
break
}
// Extract all needed data from the current chunk and append the
// extracted samples to the materialized view.
for !op.Consumed() && !op.CurrentTime().After(targetTime) {
view.appendSamples(fp, op.ExtractSamples(Values(currentChunk)))
}
}
giveBackOp(op)
}
extractionTimer.Stop()
viewJob.output <- view