forward samples in sequence
This commit is contained in:
parent
a8c60c9f2b
commit
ea2249c30c
|
@ -180,8 +180,8 @@ BasicAuthUser = ""
|
||||||
# Basic auth password
|
# Basic auth password
|
||||||
BasicAuthPass = ""
|
BasicAuthPass = ""
|
||||||
# timeout settings, unit: ms
|
# timeout settings, unit: ms
|
||||||
Timeout = 30000
|
Timeout = 10000
|
||||||
DialTimeout = 10000
|
DialTimeout = 3000
|
||||||
TLSHandshakeTimeout = 30000
|
TLSHandshakeTimeout = 30000
|
||||||
ExpectContinueTimeout = 1000
|
ExpectContinueTimeout = 1000
|
||||||
IdleConnTimeout = 90000
|
IdleConnTimeout = 90000
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/didi/nightingale/v5/src/server/config"
|
"github.com/didi/nightingale/v5/src/server/config"
|
||||||
|
@ -143,8 +144,23 @@ func (ws *WritersType) StartConsumer(index int, ch chan *prompb.TimeSeries) {
|
||||||
// @Author: quzhihao
|
// @Author: quzhihao
|
||||||
func (ws *WritersType) post(index int, series []*prompb.TimeSeries) {
|
func (ws *WritersType) post(index int, series []*prompb.TimeSeries) {
|
||||||
header := map[string]string{"hash": fmt.Sprintf("%s-%d", config.C.Heartbeat.Endpoint, index)}
|
header := map[string]string{"hash": fmt.Sprintf("%s-%d", config.C.Heartbeat.Endpoint, index)}
|
||||||
for key := range ws.backends {
|
if len(ws.backends) == 1 {
|
||||||
go ws.backends[key].Write(series, header)
|
for key := range ws.backends {
|
||||||
|
ws.backends[key].Write(series, header)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ws.backends) > 1 {
|
||||||
|
wg := new(sync.WaitGroup)
|
||||||
|
for key := range ws.backends {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(wg *sync.WaitGroup, backend WriterType, items []*prompb.TimeSeries, header map[string]string) {
|
||||||
|
defer wg.Done()
|
||||||
|
backend.Write(series, header)
|
||||||
|
}(wg, ws.backends[key], series, header)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue