Move emptiness check to the receivers.
This commit is contained in:
parent
5d3cd65a5d
commit
8a1c195b54
8
main.go
8
main.go
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue