提交 a0c5f940 编写于 作者: U Ulric Qin

use goroutine to send metrics to backend

上级 9ba1c2c3
......@@ -199,19 +199,11 @@ func (ws *WritersType) StartConsumer(ident string, ch chan *prompb.TimeSeries) {
// post post series to TSDB
// @Author: quzhihao
func (ws *WritersType) post(ident string, series []*prompb.TimeSeries) {
wg := sync.WaitGroup{}
wg.Add(len(ws.backends))
// maybe as backend hashstring
headers := map[string]string{"ident": ident}
for key := range ws.backends {
go func(key string) {
defer wg.Done()
ws.backends[key].Write(series, headers)
}(key)
go ws.backends[key].Write(series, headers)
}
wg.Wait()
}
func NewWriters() WritersType {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册