From 0a787fca3e8d675da7255c7f7ac2261ff8b420c1 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 12 Jan 2023 17:40:42 +0100 Subject: [PATCH] /lib/promscrape: use correct err logger for scrape unmarshalling (#3645) /lib/promscrape: use correct err logger for scrape unmarshalling It correctly suppresses scrape errors and adds correct context for err msg --- docs/CHANGELOG.md | 1 + lib/promscrape/scrapework.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4da655fb8..b24ca6154 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -15,6 +15,7 @@ The following tip changes can be tested by building VictoriaMetrics components f ## v1.79.x long-time support release (LTS) +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): correctly log scrape errors when flag`-promscrape.suppressScrapeErrors` is enabled and provide correct error context for it. Previously, it logged the error without the context of which job failed. * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly parse `M` and `Mi` suffixes as `1e6` multipliers in `1M` and `1Mi` numeric constants. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664). The issue has been introduced in [v1.79.7](https://docs.victoriametrics.com/CHANGELOG.html#v1797). ## [v1.79.7](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.79.7) diff --git a/lib/promscrape/scrapework.go b/lib/promscrape/scrapework.go index ea154f92a..d8eb3a46a 100644 --- a/lib/promscrape/scrapework.go +++ b/lib/promscrape/scrapework.go @@ -745,7 +745,7 @@ func (sw *scrapeWork) sendStaleSeries(lastScrape, currScrape string, timestamp i } wc := &writeRequestCtx{} if bodyString != "" { - wc.rows.Unmarshal(bodyString) + wc.rows.UnmarshalWithErrLogger(bodyString, sw.logError) srcRows := wc.rows.Rows for i := range srcRows { sw.addRowToTimeseries(wc, &srcRows[i], timestamp, true)