This commit is contained in:
UlricQin 2021-07-30 10:14:34 +08:00
commit 834a5e83ee
1 changed files with 7 additions and 6 deletions

View File

@ -226,25 +226,26 @@ func (pd *PromeDataSource) processWrite(payload []byte) {
newC := c
go func(cc *HttpClient, payload []byte) {
sendOk := false
var err error
var rec bool
var finalErr error
for i := 0; i < retry; i++ {
err = remoteWritePost(cc, payload)
err := remoteWritePost(cc, payload)
if err == nil {
sendOk = true
break
}
err, rec = err.(RecoverableError)
_, rec = err.(RecoverableError)
if !rec {
finalErr = err
break
}
logger.Warningf("send prome fail: %v", err)
logger.Warningf("[send prome fail recoverableError][retry: %d/%d][err:%v]", i+1, retry, err)
time.Sleep(time.Millisecond * 100)
}
if !sendOk {
logger.Errorf("send prome finally fail: %v", err)
logger.Errorf("send prome finally fail: %v", finalErr)
} else {
logger.Infof("send to prome %s ok", cc.url.String())
}