Skip to content

Commit

Permalink
fix: scrape timeout message of targets list
Browse files Browse the repository at this point in the history
  • Loading branch information
RayHuangCN committed Jan 18, 2021
1 parent d0ecb04 commit 681196f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/explore/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func (e *Explore) Run(ctx context.Context, con int) error {
hash := tar.target.Hash
err := e.exploreOnce(ctx, tar)
if err != nil {
e.logger.Error(err.Error())
go func() {
time.Sleep(e.retryInterval)
e.targetsLock.Lock()
Expand Down
3 changes: 3 additions & 0 deletions pkg/sidecar/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// send origin result to prometheus
if _, err := io.Copy(w, bytes.NewBuffer(data)); err != nil {
scrapErr = fmt.Errorf("copy data to prometheus failed %v", err)
if time.Now().Sub(start) > time.Duration(jobInfo.Config.ScrapeTimeout) {
scrapErr = fmt.Errorf("scrape timeout")
}
return
}

Expand Down

0 comments on commit 681196f

Please sign in to comment.