Move emptiness check to the receivers.

This commit is contained in:
beorn7 2015-02-12 19:47:24 +01:00
parent 5d3cd65a5d
commit 8a1c195b54
2 changed files with 6 additions and 5 deletions

View File

@ -218,11 +218,9 @@ func (p *prometheus) Serve() {
}()
for samples := range p.unwrittenSamples {
if len(samples) > 0 {
p.storage.AppendSamples(samples)
if p.remoteTSDBQueue != nil {
p.remoteTSDBQueue.Queue(samples)
}
p.storage.AppendSamples(samples)
if p.remoteTSDBQueue != nil {
p.remoteTSDBQueue.Queue(samples)
}
}

View File

@ -115,6 +115,9 @@ func NewTSDBQueueManager(tsdb TSDBClient, queueCapacity int) *TSDBQueueManager {
// Queue queues a sample batch to be sent to the TSDB. It drops the most
// recently queued samples on the floor if the queue is full.
func (t *TSDBQueueManager) Queue(s clientmodel.Samples) {
if len(s) == 0 {
return
}
select {
case t.queue <- s:
default: