mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Only relabelling should apply for scrape_samples_scraped_post_relabelling. (#7342)
More consistent variable names. Fixes #7298 Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
This commit is contained in:
parent
c729df3d0f
commit
f9d21f10ec
|
@ -1140,7 +1140,7 @@ loop:
|
|||
|
||||
if ok {
|
||||
err = app.AddFast(ce.ref, t, v)
|
||||
sampleAdded, err = sl.checkAddError(ce, met, tp, err, &sampleLimitErr, &appErrs)
|
||||
_, err = sl.checkAddError(ce, met, tp, err, &sampleLimitErr, &appErrs)
|
||||
// In theory this should never happen.
|
||||
if err == storage.ErrNotFound {
|
||||
ok = false
|
||||
|
@ -1187,10 +1187,10 @@ loop:
|
|||
}
|
||||
}
|
||||
|
||||
// Increment added even if there's a sampleLimitErr so we correctly report the number of samples scraped.
|
||||
if sampleAdded || sampleLimitErr != nil {
|
||||
added++
|
||||
}
|
||||
// Increment added even if there's an error so we correctly report the
|
||||
// number of samples remaining after relabelling.
|
||||
added++
|
||||
|
||||
}
|
||||
if sampleLimitErr != nil {
|
||||
if err == nil {
|
||||
|
@ -1275,7 +1275,7 @@ const (
|
|||
scrapeSeriesAddedMetricName = "scrape_series_added" + "\xff"
|
||||
)
|
||||
|
||||
func (sl *scrapeLoop) report(start time.Time, duration time.Duration, scraped, appended, seriesAdded int, scrapeErr error) (err error) {
|
||||
func (sl *scrapeLoop) report(start time.Time, duration time.Duration, scraped, added, seriesAdded int, scrapeErr error) (err error) {
|
||||
sl.scraper.Report(start, duration, scrapeErr)
|
||||
|
||||
ts := timestamp.FromTime(start)
|
||||
|
@ -1302,7 +1302,7 @@ func (sl *scrapeLoop) report(start time.Time, duration time.Duration, scraped, a
|
|||
if err = sl.addReportSample(app, scrapeSamplesMetricName, ts, float64(scraped)); err != nil {
|
||||
return
|
||||
}
|
||||
if err = sl.addReportSample(app, samplesPostRelabelMetricName, ts, float64(appended)); err != nil {
|
||||
if err = sl.addReportSample(app, samplesPostRelabelMetricName, ts, float64(added)); err != nil {
|
||||
return
|
||||
}
|
||||
if err = sl.addReportSample(app, scrapeSeriesAddedMetricName, ts, float64(seriesAdded)); err != nil {
|
||||
|
|
|
@ -1340,7 +1340,7 @@ func TestScrapeLoopAppendGracefullyIfAmendOrOutOfOrderOrOutOfBounds(t *testing.T
|
|||
}
|
||||
testutil.Equals(t, want, app.result, "Appended samples not as expected")
|
||||
testutil.Equals(t, 4, total)
|
||||
testutil.Equals(t, 1, added)
|
||||
testutil.Equals(t, 4, added)
|
||||
testutil.Equals(t, 1, seriesAdded)
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1365,7 @@ func TestScrapeLoopOutOfBoundsTimeError(t *testing.T) {
|
|||
now := time.Now().Add(20 * time.Minute)
|
||||
total, added, seriesAdded, err := sl.append([]byte("normal 1\n"), "", now)
|
||||
testutil.Equals(t, 1, total)
|
||||
testutil.Equals(t, 0, added)
|
||||
testutil.Equals(t, 1, added)
|
||||
testutil.Equals(t, 0, seriesAdded)
|
||||
|
||||
testutil.Ok(t, err)
|
||||
|
|
Loading…
Reference in a new issue