Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

up healthmetric not work as expected in 2.0 (code bug) #2800

Closed
qinguoan opened this Issue Jun 2, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@qinguoan
Copy link

qinguoan commented Jun 2, 2017

                err := sl.scraper.scrape(scrapeCtx, buf)
		cancel()
		var b []byte
		if err == nil {
			b = buf.Bytes()
		} else if errc != nil {
			errc <- err
		}
		// A failed scrape is the same as an empty scrape,
		// we still call sl.append to trigger stale markers.
		if total, added, err = sl.append(b, start); err != nil {
			sl.l.With("err", err).Error("append failed")
			// The append failed, probably due to a parse error.
			// Call sl.append again with an empty scrape to trigger stale markers.
			if _, _, err = sl.append([]byte{}, start); err != nil {
				sl.l.With("err", err).Error("append failed")
			}
		}

		sl.report(start, time.Since(start), total, added, err)

Last line sl.report call may be use nil as parameter err after a scrape error occurred, because scrape error overwrite by append error. But.... append with zero length bytes(scrape failed) will not cause an error.

sorry for my poor English -_-

@qinguoan qinguoan changed the title up healthmetric not work as expected in 2.0 up healthmetric not work as expected in 2.0 (code bug) Jun 2, 2017

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 2, 2017

#2787 fixes this.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jun 6, 2017

Merged.

@fabxc fabxc closed this Jun 6, 2017

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.