post series concurrency
This commit is contained in:
parent
46cd4a21ac
commit
e794ca86f3
|
@ -3,6 +3,7 @@ package agent
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"flashcat.cloud/categraf/config"
|
||||
|
@ -84,8 +85,13 @@ func postSeries(series []*prompb.TimeSeries) {
|
|||
return
|
||||
}
|
||||
|
||||
for _, w := range writer.Writers {
|
||||
w.Write(series)
|
||||
wg := sync.WaitGroup{}
|
||||
for key := range writer.Writers {
|
||||
wg.Add(1)
|
||||
go func(key string) {
|
||||
defer wg.Done()
|
||||
writer.Writers[key].Write(series)
|
||||
}(key)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ func (w WriterType) Post(req []byte) error {
|
|||
|
||||
httpReq.Header.Add("Content-Encoding", "snappy")
|
||||
httpReq.Header.Set("Content-Type", "application/x-protobuf")
|
||||
httpReq.Header.Set("User-Agent", "n9e")
|
||||
httpReq.Header.Set("User-Agent", "categraf")
|
||||
httpReq.Header.Set("X-Prometheus-Remote-Write-Version", "0.1.0")
|
||||
|
||||
if w.Opts.BasicAuthUser != "" {
|
||||
|
|
Loading…
Reference in New Issue