Repository: VictoriaMetrics/VictoriaMetrics
Pull request #6434 (2024-06-07 11:36:18)

added max_scrape_size to scrape config
### Describe Your Changes

Related to https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6429

### Checklist

The following checks are **mandatory**:

- [ ] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/).



Patch:
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 1b6e4a879..f54fea4be 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -40,6 +40,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
 * FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth/): add `idleConnTimeout` flag set to 50s by default. It should reduce the probability of `broken pipe` or `connection reset by peer` errors in vmauth logs.
 * FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth/): add auto request retry for trivial network errors, such as `broken pipe` and `connection reset` for requests to the configured backends.
 * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent/): increase default value of `-promscrape.maxDroppedTargets` command-line flag to 10_000 from 1000. This makes it easier to track down large number of dropped targets.
+* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `max_scrape_size` parameter to a scrape config for setting a custom scrape limit for a job. The new [automatically generated metric](https://docs.victoriametrics.com/vmagent/#automatically-generated-metrics) `scrape_response_size_bytes` was added to reflect the response size of the target.
 * FEATURE: [vmsingle](https://docs.victoriametrics.com/single-server-victoriametrics/): check for ranged vector arguments in non-rollup expressions when `-search.disableImplicitConversion` or `-search.logImplicitConversion` are enabled. For example, `sum(up[5m])` or `absent(up[5m])` will fail to execute if these flags are set.
 * FEATURE: [vmsingle](https://docs.victoriametrics.com/single-server-victoriametrics/): validate that rollup expressions has ranged vector arguments passed when `-search.disableImplicitConversion` or `-search.logImplicitConversion` are enabled. For example, `rate(metric)` or `count_over_time(metric)` will fail to execute if these flags are set.
 * FEATURE: [vmalert-tool](https://docs.victoriametrics.com/vmalert-tool/): support file path with hierarchical patterns and regexpes, and http url in unittest cmd-line flag `-files`, e.g. `-files="http://<some-server-addr>/path/to/rules"` or `-files="dir/**/*.yaml"`.
diff --git a/docs/sd_configs.md b/docs/sd_configs.md
index eda9a4a8c..6f50ffbd2 100644
--- a/docs/sd_configs.md
+++ b/docs/sd_configs.md
@@ -1692,6 +1692,14 @@ scrape_configs:
   #
   # scrape_timeout: <duration>
 
+  # max_scrape_size is an optional parameter for limiting the response size in bytes from scraped targets.
+  # By default, uses limit from -promscrape.maxScrapeSize command-line flag.
+  # Example values:
+  # - "10MiB" - 10 * 1024 * 1024 bytes
+  # - "100MB" - 100 * 1000 * 1000 bytes
+  #
+  # max_scrape_size: <size>
+
   # metrics_path is the path to fetch metrics from targets.
   # By default, metrics are fetched from "/metrics" path.
   #
diff --git a/docs/vmagent.md b/docs/vmagent.md
index 85bc603cc..28028f94c 100644
--- a/docs/vmagent.md
+++ b/docs/vmagent.md
@@ -486,6 +486,14 @@ and attaches `instance`, `job` and other target-specific labels to these metrics
   scrape_duration_seconds > 1.5
   ```
 
+* `scrape_response_size_bytes` - response size in bytes for the given target. This allows to monitor amount of data scraped
+  and to adjust `max_scrape_size` for scraped targets. For example, the following [MetricsQL query](https://docs.victoriametrics.com/metricsql/)
+  returns targets with scrape response > 10MiB:
+
+  ```metricsql
+  max_scrape_size > 10MiB
+  ```
+
 * `scrape_timeout_seconds` - the configured timeout for the current scrape target (aka `scrape_timeout`).
   This allows detecting targets with scrape durations close to the configured scrape timeout.
   For example, the following [MetricsQL query](https://docs.victoriametrics.com/metricsql/) returns targets (identified by `instance` label),
diff --git a/lib/flagutil/bytes.go b/lib/flagutil/bytes.go
index 6f60a0aa0..ccf0db105 100644
--- a/lib/flagutil/bytes.go
+++ b/lib/flagutil/bytes.go
@@ -53,79 +53,77 @@ func (b *Bytes) Set(value string) error {
 		return nil
 	}
 	value = normalizeBytesString(value)
+	n, err := parseBytes(value)
+	if err != nil {
+		return err
+	}
+	b.N = n
+	b.valueString = value
+	return nil
+}
+
+// ParseBytes returns int64 in bytes of parsed string with unit suffix
+func ParseBytes(value string) (int64, error) {
+	value = normalizeBytesString(value)
+	return parseBytes(value)
+}
+
+func parseBytes(value string) (int64, error) {
 	switch {
 	case strings.HasSuffix(value, "KB"):
 		f, err := strconv.ParseFloat(value[:len(value)-2], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1000)
-		b.valueString = value
-		return nil
+		return int64(f * 1000), nil
 	case strings.HasSuffix(value, "MB"):
 		f, err := strconv.ParseFloat(value[:len(value)-2], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1000 * 1000)
-		b.valueString = value
-		return nil
+		return int64(f * 1000 * 1000), nil
 	case strings.HasSuffix(value, "GB"):
 		f, err := strconv.ParseFloat(value[:len(value)-2], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1000 * 1000 * 1000)
-		b.valueString = value
-		return nil
+		return int64(f * 1000 * 1000 * 1000), nil
 	case strings.HasSuffix(value, "TB"):
 		f, err := strconv.ParseFloat(value[:len(value)-2], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1000 * 1000 * 1000 * 1000)
-		b.valueString = value
-		return nil
+		return int64(f * 1000 * 1000 * 1000 * 1000), nil
 	case strings.HasSuffix(value, "KiB"):
 		f, err := strconv.ParseFloat(value[:len(value)-3], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1024)
-		b.valueString = value
-		return nil
+		return int64(f * 1024), nil
 	case strings.HasSuffix(value, "MiB"):
 		f, err := strconv.ParseFloat(value[:len(value)-3], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1024 * 1024)
-		b.valueString = value
-		return nil
+		return int64(f * 1024 * 1024), nil
 	case strings.HasSuffix(value, "GiB"):
 		f, err := strconv.ParseFloat(value[:len(value)-3], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1024 * 1024 * 1024)
-		b.valueString = value
-		return nil
+		return int64(f * 1024 * 1024 * 1024), nil
 	case strings.HasSuffix(value, "TiB"):
 		f, err := strconv.ParseFloat(value[:len(value)-3], 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f * 1024 * 1024 * 1024 * 1024)
-		b.valueString = value
-		return nil
+		return int64(f * 1024 * 1024 * 1024 * 1024), nil
 	default:
 		f, err := strconv.ParseFloat(value, 64)
 		if err != nil {
-			return err
+			return 0, err
 		}
-		b.N = int64(f)
-		b.valueString = value
-		return nil
+		return int64(f), nil
 	}
 }
 
diff --git a/lib/promscrape/client.go b/lib/promscrape/client.go
index 17094cae5..f26fbc6ba 100644
--- a/lib/promscrape/client.go
+++ b/lib/promscrape/client.go
@@ -18,8 +18,6 @@ import (
 )
 
 var (
-	maxScrapeSize = flagutil.NewBytes("promscrape.maxScrapeSize", 16*1024*1024, "The maximum size of scrape response in bytes to process from Prometheus targets. "+
-		"Bigger responses are rejected")
 	maxResponseHeadersSize = flagutil.NewBytes("promscrape.maxResponseHeadersSize", 4096, "The maximum size of http response headers from Prometheus scrape targets")
 	disableCompression     = flag.Bool("promscrape.disableCompression", false, "Whether to disable sending 'Accept-Encoding: gzip' request headers to all the scrape targets. "+
 		"This may reduce CPU usage on scrape targets at the cost of higher network bandwidth utilization. "+
@@ -41,6 +39,7 @@ type client struct {
 	scrapeTimeoutSecondsStr string
 	setHeaders              func(req *http.Request) error
 	setProxyHeaders         func(req *http.Request) error
+	maxScrapeSize           int64
 }
 
 func newClient(ctx context.Context, sw *ScrapeWork) (*client, error) {
@@ -91,6 +90,7 @@ func newClient(ctx context.Context, sw *ScrapeWork) (*client, error) {
 		scrapeTimeoutSecondsStr: fmt.Sprintf("%.3f", sw.ScrapeTimeout.Seconds()),
 		setHeaders:              setHeaders,
 		setProxyHeaders:         setProxyHeaders,
+		maxScrapeSize:           sw.MaxScrapeSize,
 	}
 	return c, nil
 }
@@ -149,7 +149,7 @@ func (c *client) ReadData(dst *bytesutil.ByteBuffer) error {
 	// Read the data from resp.Body
 	r := &io.LimitedReader{
 		R: resp.Body,
-		N: maxScrapeSize.N,
+		N: c.maxScrapeSize,
 	}
 	_, err = dst.ReadFrom(r)
 	_ = resp.Body.Close()
@@ -160,10 +160,11 @@ func (c *client) ReadData(dst *bytesutil.ByteBuffer) error {
 		}
 		return fmt.Errorf("cannot read data from %s: %w", c.scrapeURL, err)
 	}
-	if int64(len(dst.B)) >= maxScrapeSize.N {
+	if int64(len(dst.B)) >= c.maxScrapeSize {
 		maxScrapeSizeExceeded.Inc()
-		return fmt.Errorf("the response from %q exceeds -promscrape.maxScrapeSize=%d; "+
-			"either reduce the response size for the target or increase -promscrape.maxScrapeSize command-line flag value", c.scrapeURL, maxScrapeSize.N)
+		return fmt.Errorf("the response from %q exceeds -promscrape.maxScrapeSize=%d or max_scrape_size in a scrape config. "+
+			"Possible solutions are: reduce the response size for the target, increase -promscrape.maxScrapeSize command-line flag, "+
+			"increase max_scrape_size value in scrape config", c.scrapeURL, maxScrapeSize.N)
 	}
 	return nil
 }
diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go
index b0ea9603f..8144f1e8e 100644
--- a/lib/promscrape/config.go
+++ b/lib/promscrape/config.go
@@ -16,6 +16,7 @@ import (
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil"
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/cgroup"
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/envtemplate"
+	"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/fs/fscore"
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
 	"github.com/VictoriaMetrics/VictoriaMetrics/lib/promauth"
@@ -76,6 +77,8 @@ var (
 	clusterName = flag.String("promscrape.cluster.name", "", "Optional name of the cluster. If multiple vmagent clusters scrape the same targets, "+
 		"then each cluster must have unique name in order to properly de-duplicate samples received from these clusters. "+
 		"See https://docs.victoriametrics.com/vmagent/#scraping-big-number-of-targets for more info")
+	maxScrapeSize = flagutil.NewBytes("promscrape.maxScrapeSize", 16*1024*1024, "The maximum size of scrape response in bytes to process from Prometheus targets. "+
+		"Bigger responses are rejected")
 )
 
 var clusterMemberID int
@@ -269,6 +272,7 @@ type ScrapeConfig struct {
 	JobName        string              `yaml:"job_name"`
 	ScrapeInterval *promutils.Duration `yaml:"scrape_interval,omitempty"`
 	ScrapeTimeout  *promutils.Duration `yaml:"scrape_timeout,omitempty"`
+	MaxScrapeSize  string              `yaml:"max_scrape_size,omitempty"`
 	MetricsPath    string              `yaml:"metrics_path,omitempty"`
 	HonorLabels    bool                `yaml:"honor_labels,omitempty"`
 
@@ -845,6 +849,14 @@ func getScrapeWorkConfig(sc *ScrapeConfig, baseDir string, globalCfg *GlobalConf
 		// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1281#issuecomment-840538907
 		scrapeTimeout = scrapeInterval
 	}
+	var err error
+	mss := maxScrapeSize.N
+	if len(sc.MaxScrapeSize) > 0 {
+		mss, err = flagutil.ParseBytes(sc.MaxScrapeSize)
+		if err != nil {
+			return nil, fmt.Errorf("unexpected `max_scrape_size` value %q for `job_name` %q`: %w", sc.MaxScrapeSize, jobName, err)
+		}
+	}
 	honorLabels := sc.HonorLabels
 	honorTimestamps := sc.HonorTimestamps
 	denyRedirects := false
@@ -897,6 +909,7 @@ func getScrapeWorkConfig(sc *ScrapeConfig, baseDir string, globalCfg *GlobalConf
 		scrapeIntervalString: scrapeInterval.String(),
 		scrapeTimeout:        scrapeTimeout,
 		scrapeTimeoutString:  scrapeTimeout.String(),
+		maxScrapeSize:        mss,
 		jobName:              jobName,
 		metricsPath:          metricsPath,
 		scheme:               scheme,
@@ -927,6 +940,7 @@ type scrapeWorkConfig struct {
 	scrapeIntervalString string
 	scrapeTimeout        time.Duration
 	scrapeTimeoutString  string
+	maxScrapeSize        int64
 	jobName              string
 	metricsPath          string
 	scheme               string
@@ -1201,6 +1215,7 @@ func (swc *scrapeWorkConfig) getScrapeWork(target string, extraLabels, metaLabel
 		ScrapeURL:            scrapeURL,
 		ScrapeInterval:       scrapeInterval,
 		ScrapeTimeout:        scrapeTimeout,
+		MaxScrapeSize:        swc.maxScrapeSize,
 		HonorLabels:          swc.honorLabels,
 		HonorTimestamps:      swc.honorTimestamps,
 		DenyRedirects:        swc.denyRedirects,
diff --git a/lib/promscrape/scrapework.go b/lib/promscrape/scrapework.go
index ad478dbf7..3897ea376 100644
--- a/lib/promscrape/scrapework.go
+++ b/lib/promscrape/scrapework.go
@@ -53,6 +53,9 @@ type ScrapeWork struct {
 	// Timeout for scraping the ScrapeURL.
 	ScrapeTimeout time.Duration
 
+	// MaxScrapeSize sets max amount of data, that can be scraped by a job
+	MaxScrapeSize int64
+
 	// How to deal with conflicting labels.
 	// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
 	HonorLabels bool
@@ -500,6 +503,7 @@ func (sw *scrapeWork) processDataOneShot(scrapeTimestamp, realTimestamp int64, b
 	am := &autoMetrics{
 		up:                        up,
 		scrapeDurationSeconds:     scrapeDurationSeconds,
+		scrapeResponseSize:        float64(len(bodyString)),
 		samplesScraped:            samplesScraped,
 		samplesPostRelabeling:     samplesPostRelabeling,
 		seriesAdded:               seriesAdded,
@@ -519,7 +523,7 @@ func (sw *scrapeWork) processDataOneShot(scrapeTimestamp, realTimestamp int64, b
 		sw.storeLastScrape(body)
 	}
 	sw.finalizeLastScrape()
-	tsmGlobal.Update(sw, up == 1, realTimestamp, int64(scrapeDurationSeconds*1000), samplesScraped, err)
+	tsmGlobal.Update(sw, up == 1, realTimestamp, int64(scrapeDurationSeconds*1000), float64(len(bodyString)), samplesScraped, err)
 	return err
 }
 
@@ -580,6 +584,7 @@ func (sw *scrapeWork) processDataInStreamMode(scrapeTimestamp, realTimestamp int
 	am := &autoMetrics{
 		up:                        up,
 		scrapeDurationSeconds:     scrapeDurationSeconds,
+		scrapeResponseSize:        float64(len(bodyString)),
 		samplesScraped:            samplesScraped,
 		samplesPostRelabeling:     samplesPostRelabeling,
 		seriesAdded:               seriesAdded,
@@ -598,7 +603,7 @@ func (sw *scrapeWork) processDataInStreamMode(scrapeTimestamp, realTimestamp int
 		sw.storeLastScrape(body.B)
 	}
 	sw.finalizeLastScrape()
-	tsmGlobal.Update(sw, up == 1, realTimestamp, int64(scrapeDurationSeconds*1000), samplesScraped, err)
+	tsmGlobal.Update(sw, up == 1, realTimestamp, int64(scrapeDurationSeconds*1000), float64(len(bodyString)), samplesScraped, err)
 	// Do not track active series in streaming mode, since this may need too big amounts of memory
 	// when the target exports too big number of metrics.
 	return err
@@ -812,6 +817,7 @@ func (sw *scrapeWork) getLabelsHash(labels []prompbmarshal.Label) uint64 {
 type autoMetrics struct {
 	up                        int
 	scrapeDurationSeconds     float64
+	scrapeResponseSize        float64
 	samplesScraped            int
 	samplesPostRelabeling     int
 	seriesAdded               int
@@ -824,7 +830,7 @@ func isAutoMetric(s string) bool {
 		"scrape_samples_post_metric_relabeling", "scrape_series_added",
 		"scrape_timeout_seconds", "scrape_samples_limit",
 		"scrape_series_limit_samples_dropped", "scrape_series_limit",
-		"scrape_series_current":
+		"scrape_series_current", "scrape_response_size_bytes":
 		return true
 	}
 	return false
@@ -833,6 +839,7 @@ func isAutoMetric(s string) bool {
 func (sw *scrapeWork) addAutoMetrics(am *autoMetrics, wc *writeRequestCtx, timestamp int64) {
 	sw.addAutoTimeseries(wc, "up", float64(am.up), timestamp)
 	sw.addAutoTimeseries(wc, "scrape_duration_seconds", am.scrapeDurationSeconds, timestamp)
+	sw.addAutoTimeseries(wc, "scrape_response_size_bytes", am.scrapeResponseSize, timestamp)
 	sw.addAutoTimeseries(wc, "scrape_samples_scraped", float64(am.samplesScraped), timestamp)
 	sw.addAutoTimeseries(wc, "scrape_samples_post_metric_relabeling", float64(am.samplesPostRelabeling), timestamp)
 	sw.addAutoTimeseries(wc, "scrape_series_added", float64(am.seriesAdded), timestamp)
diff --git a/lib/promscrape/targetstatus.go b/lib/promscrape/targetstatus.go
index afdd47d64..364acff4c 100644
--- a/lib/promscrape/targetstatus.go
+++ b/lib/promscrape/targetstatus.go
@@ -178,7 +178,7 @@ func (tsm *targetStatusMap) Unregister(sw *scrapeWork) {
 	tsm.mu.Unlock()
 }
 
-func (tsm *targetStatusMap) Update(sw *scrapeWork, up bool, scrapeTime, scrapeDuration int64, samplesScraped int, err error) {
+func (tsm *targetStatusMap) Update(sw *scrapeWork, up bool, scrapeTime, scrapeDuration int64, scrapeResponseSize float64, samplesScraped int, err error) {
 	jobName := sw.Config.jobNameOriginal
 
 	tsm.mu.Lock()
@@ -197,6 +197,7 @@ func (tsm *targetStatusMap) Update(sw *scrapeWork, up bool, scrapeTime, scrapeDu
 	ts.scrapeTime = scrapeTime
 	ts.scrapeDuration = scrapeDuration
 	ts.samplesScraped = samplesScraped
+	ts.scrapeResponseSize = scrapeResponseSize
 	ts.scrapesTotal++
 	if !up {
 		ts.scrapesFailed++
@@ -295,14 +296,15 @@ func writeLabelsJSON(w io.Writer, labels *promutils.Labels) {
 }
 
 type targetStatus struct {
-	sw             *scrapeWork
-	up             bool
-	scrapeTime     int64
-	scrapeDuration int64
-	samplesScraped int
-	scrapesTotal   int
-	scrapesFailed  int
-	err            error
+	sw                 *scrapeWork
+	up                 bool
+	scrapeTime         int64
+	scrapeDuration     int64
+	scrapeResponseSize float64
+	samplesScraped     int
+	scrapesTotal       int
+	scrapesFailed      int
+	err                error
 }
 
 func (ts *targetStatus) getDurationFromLastScrape() string {
@@ -313,6 +315,13 @@ func (ts *targetStatus) getDurationFromLastScrape() string {
 	return fmt.Sprintf("%.3fs ago", d.Seconds())
 }
 
+func (ts *targetStatus) getSizeFromLastScrape() string {
+	if ts.scrapeResponseSize <= 0 {
+		return "never scraped"
+	}
+	return fmt.Sprintf("%.3f kb", float64(ts.scrapeResponseSize)/1024)
+}
+
 type droppedTargets struct {
 	mu sync.Mutex
 	m  map[uint64]droppedTarget
diff --git a/lib/promscrape/targetstatus.qtpl b/lib/promscrape/targetstatus.qtpl
index bf84ff7c1..8bacbcba1 100644
--- a/lib/promscrape/targetstatus.qtpl
+++ b/lib/promscrape/targetstatus.qtpl
@@ -29,6 +29,7 @@
 		scrapes_failed={%d ts.scrapesFailed %},{% space %}
 		last_scrape={%s ts.getDurationFromLastScrape() %},{% space %}
 		scrape_duration={%d int(ts.scrapeDuration) %}ms,{% space %}
+                scrape_response_size={%s ts.getSizeFromLastScrape() %},{% space %}
 		samples_scraped={%d ts.samplesScraped %},{% space %}
 		error={% if ts.err != nil %}{%s= ts.err.Error() %}{% endif %}
 		{% newline %}
@@ -217,6 +218,7 @@
                             <th scope="col" title="total scrape errors">Errors</th>
                             <th scope="col" title="the time of the last scrape">Last Scrape</th>
                             <th scope="col" title="the duration of the last scrape">Duration</th>
+                            <th scope="col" title="the size of the last scrape">Last Scrape Size</th>
                             <th scope="col" title="the number of metrics scraped during the last scrape">Samples</th>
                             <th scope="col" title="error from the last scrape (if any)">Last error</th>
                         </tr>
@@ -269,8 +271,9 @@
                             {% endif %}
                             <td>{%d ts.scrapesTotal %}</td>
                             <td>{%d ts.scrapesFailed %}</td>
-                            <td>{%s ts.getDurationFromLastScrape() %}
+                            <td>{%s ts.getDurationFromLastScrape() %}</td>
                             <td>{%d int(ts.scrapeDuration) %}ms</td>
+                            <td>{%s ts.getSizeFromLastScrape() %}</td>
                             <td>{%d ts.samplesScraped %}</td>
                             <td>{% if ts.err != nil %}{%s ts.err.Error() %}{% endif %}</td>
                         </tr>
diff --git a/lib/promscrape/targetstatus.qtpl.go b/lib/promscrape/targetstatus.qtpl.go
index 4b736f614..53e820a52 100644
--- a/lib/promscrape/targetstatus.qtpl.go
+++ b/lib/promscrape/targetstatus.qtpl.go
@@ -141,891 +141,903 @@ func StreamTargetsResponsePlain(qw422016 *qt422016.Writer, tsr *targetsStatusRes
 //line lib/promscrape/targetstatus.qtpl:31
 			qw422016.N().S(` `)
 //line lib/promscrape/targetstatus.qtpl:31
-			qw422016.N().S(`samples_scraped=`)
+			qw422016.N().S(`scrape_response_size=`)
 //line lib/promscrape/targetstatus.qtpl:32
-			qw422016.N().D(ts.samplesScraped)
+			qw422016.E().S(ts.getSizeFromLastScrape())
 //line lib/promscrape/targetstatus.qtpl:32
 			qw422016.N().S(`,`)
 //line lib/promscrape/targetstatus.qtpl:32
 			qw422016.N().S(` `)
 //line lib/promscrape/targetstatus.qtpl:32
-			qw422016.N().S(`error=`)
+			qw422016.N().S(`samples_scraped=`)
 //line lib/promscrape/targetstatus.qtpl:33
-			if ts.err != nil {
+			qw422016.N().D(ts.samplesScraped)
 //line lib/promscrape/targetstatus.qtpl:33
-				qw422016.N().S(ts.err.Error())
+			qw422016.N().S(`,`)
 //line lib/promscrape/targetstatus.qtpl:33
-			}
+			qw422016.N().S(` `)
+//line lib/promscrape/targetstatus.qtpl:33
+			qw422016.N().S(`error=`)
 //line lib/promscrape/targetstatus.qtpl:34
+			if ts.err != nil {
+//line lib/promscrape/targetstatus.qtpl:34
+				qw422016.N().S(ts.err.Error())
+//line lib/promscrape/targetstatus.qtpl:34
+			}
+//line lib/promscrape/targetstatus.qtpl:35
 			qw422016.N().S(`
 `)
-//line lib/promscrape/targetstatus.qtpl:35
-		}
 //line lib/promscrape/targetstatus.qtpl:36
+		}
+//line lib/promscrape/targetstatus.qtpl:37
 	}
-//line lib/promscrape/targetstatus.qtpl:38
+//line lib/promscrape/targetstatus.qtpl:39
 	for _, jobName := range tsr.emptyJobs {
-//line lib/promscrape/targetstatus.qtpl:38
-		qw422016.N().S(`job=`)
 //line lib/promscrape/targetstatus.qtpl:39
+		qw422016.N().S(`job=`)
+//line lib/promscrape/targetstatus.qtpl:40
 		qw422016.N().S(jobName)
-//line lib/promscrape/targetstatus.qtpl:39
+//line lib/promscrape/targetstatus.qtpl:40
 		qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:39
-		qw422016.N().S(`(0/0 up)`)
 //line lib/promscrape/targetstatus.qtpl:40
+		qw422016.N().S(`(0/0 up)`)
+//line lib/promscrape/targetstatus.qtpl:41
 		qw422016.N().S(`
 `)
-//line lib/promscrape/targetstatus.qtpl:41
+//line lib/promscrape/targetstatus.qtpl:42
 	}
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 }
 
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 func WriteTargetsResponsePlain(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	StreamTargetsResponsePlain(qw422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 }
 
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 func TargetsResponsePlain(tsr *targetsStatusResult, filter *requestFilter) string {
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	WriteTargetsResponsePlain(qb422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:43
+//line lib/promscrape/targetstatus.qtpl:44
 }
 
-//line lib/promscrape/targetstatus.qtpl:45
+//line lib/promscrape/targetstatus.qtpl:46
 func StreamTargetsResponseHTML(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:45
+//line lib/promscrape/targetstatus.qtpl:46
 	qw422016.N().S(`<!DOCTYPE html><html lang="en"><head>`)
-//line lib/promscrape/targetstatus.qtpl:49
+//line lib/promscrape/targetstatus.qtpl:50
 	htmlcomponents.StreamCommonHeader(qw422016)
-//line lib/promscrape/targetstatus.qtpl:49
+//line lib/promscrape/targetstatus.qtpl:50
 	qw422016.N().S(`<title>Active Targets</title></head><body>`)
-//line lib/promscrape/targetstatus.qtpl:53
+//line lib/promscrape/targetstatus.qtpl:54
 	htmlcomponents.StreamNavbar(qw422016)
-//line lib/promscrape/targetstatus.qtpl:53
+//line lib/promscrape/targetstatus.qtpl:54
 	qw422016.N().S(`<div class="container-fluid">`)
-//line lib/promscrape/targetstatus.qtpl:55
-	if tsr.err != nil {
 //line lib/promscrape/targetstatus.qtpl:56
-		htmlcomponents.StreamErrorNotification(qw422016, tsr.err)
+	if tsr.err != nil {
 //line lib/promscrape/targetstatus.qtpl:57
+		htmlcomponents.StreamErrorNotification(qw422016, tsr.err)
+//line lib/promscrape/targetstatus.qtpl:58
 	}
-//line lib/promscrape/targetstatus.qtpl:57
+//line lib/promscrape/targetstatus.qtpl:58
 	qw422016.N().S(`<div class="row"><main class="col-12"><h1>Active Targets</h1><hr />`)
-//line lib/promscrape/targetstatus.qtpl:62
+//line lib/promscrape/targetstatus.qtpl:63
 	streamfiltersForm(qw422016, filter)
-//line lib/promscrape/targetstatus.qtpl:62
+//line lib/promscrape/targetstatus.qtpl:63
 	qw422016.N().S(`<hr />`)
-//line lib/promscrape/targetstatus.qtpl:64
+//line lib/promscrape/targetstatus.qtpl:65
 	streamtargetsTabs(qw422016, tsr, filter, "scrapeTargets")
-//line lib/promscrape/targetstatus.qtpl:64
+//line lib/promscrape/targetstatus.qtpl:65
 	qw422016.N().S(`</main></div></div></body></html>`)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 }
 
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 func WriteTargetsResponseHTML(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	StreamTargetsResponseHTML(qw422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 }
 
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 func TargetsResponseHTML(tsr *targetsStatusResult, filter *requestFilter) string {
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	WriteTargetsResponseHTML(qb422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:70
+//line lib/promscrape/targetstatus.qtpl:71
 }
 
-//line lib/promscrape/targetstatus.qtpl:72
+//line lib/promscrape/targetstatus.qtpl:73
 func StreamServiceDiscoveryResponse(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:72
+//line lib/promscrape/targetstatus.qtpl:73
 	qw422016.N().S(`<!DOCTYPE html><html lang="en"><head>`)
-//line lib/promscrape/targetstatus.qtpl:76
+//line lib/promscrape/targetstatus.qtpl:77
 	htmlcomponents.StreamCommonHeader(qw422016)
-//line lib/promscrape/targetstatus.qtpl:76
+//line lib/promscrape/targetstatus.qtpl:77
 	qw422016.N().S(`<title>Discovered Targets</title></head><body>`)
-//line lib/promscrape/targetstatus.qtpl:80
+//line lib/promscrape/targetstatus.qtpl:81
 	htmlcomponents.StreamNavbar(qw422016)
-//line lib/promscrape/targetstatus.qtpl:80
+//line lib/promscrape/targetstatus.qtpl:81
 	qw422016.N().S(`<div class="container-fluid">`)
-//line lib/promscrape/targetstatus.qtpl:82
-	if tsr.err != nil {
 //line lib/promscrape/targetstatus.qtpl:83
-		htmlcomponents.StreamErrorNotification(qw422016, tsr.err)
+	if tsr.err != nil {
 //line lib/promscrape/targetstatus.qtpl:84
+		htmlcomponents.StreamErrorNotification(qw422016, tsr.err)
+//line lib/promscrape/targetstatus.qtpl:85
 	}
-//line lib/promscrape/targetstatus.qtpl:84
+//line lib/promscrape/targetstatus.qtpl:85
 	qw422016.N().S(`<div class="row"><main class="col-12"><h1>Discovered Targets</h1><hr />`)
-//line lib/promscrape/targetstatus.qtpl:89
+//line lib/promscrape/targetstatus.qtpl:90
 	streamfiltersForm(qw422016, filter)
-//line lib/promscrape/targetstatus.qtpl:89
+//line lib/promscrape/targetstatus.qtpl:90
 	qw422016.N().S(`<hr />`)
-//line lib/promscrape/targetstatus.qtpl:91
+//line lib/promscrape/targetstatus.qtpl:92
 	streamtargetsTabs(qw422016, tsr, filter, "discoveredTargets")
-//line lib/promscrape/targetstatus.qtpl:91
+//line lib/promscrape/targetstatus.qtpl:92
 	qw422016.N().S(`</main></div></div></body></html>`)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 }
 
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 func WriteServiceDiscoveryResponse(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	StreamServiceDiscoveryResponse(qw422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 }
 
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 func ServiceDiscoveryResponse(tsr *targetsStatusResult, filter *requestFilter) string {
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	WriteServiceDiscoveryResponse(qb422016, tsr, filter)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:97
+//line lib/promscrape/targetstatus.qtpl:98
 }
 
-//line lib/promscrape/targetstatus.qtpl:99
+//line lib/promscrape/targetstatus.qtpl:100
 func streamfiltersForm(qw422016 *qt422016.Writer, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:99
+//line lib/promscrape/targetstatus.qtpl:100
 	qw422016.N().S(`<div class="row g-3 align-items-center mb-3"><div class="col-auto"><button id="all-btn" type="button" class="btn`)
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 	if !filter.showOnlyUnhealthy {
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 		qw422016.N().S(`btn-secondary`)
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 	} else {
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 		qw422016.N().S(`btn-success`)
-//line lib/promscrape/targetstatus.qtpl:102
+//line lib/promscrape/targetstatus.qtpl:103
 	}
-//line lib/promscrape/targetstatus.qtpl:102
-	qw422016.N().S(`"onclick="location.href='?`)
 //line lib/promscrape/targetstatus.qtpl:103
+	qw422016.N().S(`"onclick="location.href='?`)
+//line lib/promscrape/targetstatus.qtpl:104
 	streamqueryArgs(qw422016, filter, map[string]string{"show_only_unhealthy": "false"})
-//line lib/promscrape/targetstatus.qtpl:103
+//line lib/promscrape/targetstatus.qtpl:104
 	qw422016.N().S(`'">All</button></div><div class="col-auto"><button id="unhealthy-btn" type="button" class="btn`)
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 	if filter.showOnlyUnhealthy {
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 		qw422016.N().S(`btn-secondary`)
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 	} else {
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 		qw422016.N().S(`btn-danger`)
-//line lib/promscrape/targetstatus.qtpl:108
+//line lib/promscrape/targetstatus.qtpl:109
 	}
-//line lib/promscrape/targetstatus.qtpl:108
-	qw422016.N().S(`"onclick="location.href='?`)
 //line lib/promscrape/targetstatus.qtpl:109
+	qw422016.N().S(`"onclick="location.href='?`)
+//line lib/promscrape/targetstatus.qtpl:110
 	streamqueryArgs(qw422016, filter, map[string]string{"show_only_unhealthy": "true"})
-//line lib/promscrape/targetstatus.qtpl:109
+//line lib/promscrape/targetstatus.qtpl:110
 	qw422016.N().S(`'">Unhealthy</button></div><div class="col-auto"><button type="button" class="btn btn-primary" onclick="document.querySelectorAll('.scrape-job').forEach((el) => { el.style.display = 'none'; })">Collapse all</button></div><div class="col-auto"><button type="button" class="btn btn-secondary" onclick="document.querySelectorAll('.scrape-job').forEach((el) => { el.style.display = 'block'; })">Expand all</button></div><div class="col-auto"><button type="button" class="btn btn-success" onclick="document.getElementById('filters').style.display='block'">Filter targets</button></div></div><div id="filters"`)
-//line lib/promscrape/targetstatus.qtpl:129
+//line lib/promscrape/targetstatus.qtpl:130
 	if filter.endpointSearch == "" && filter.labelSearch == "" {
-//line lib/promscrape/targetstatus.qtpl:129
+//line lib/promscrape/targetstatus.qtpl:130
 		qw422016.N().S(`style="display:none"`)
-//line lib/promscrape/targetstatus.qtpl:129
+//line lib/promscrape/targetstatus.qtpl:130
 	}
-//line lib/promscrape/targetstatus.qtpl:129
+//line lib/promscrape/targetstatus.qtpl:130
 	qw422016.N().S(`><form class="form-horizontal"><div class="form-group mb-3"><label for="endpoint_search" class="col-sm-10 control-label">Endpoint filter (<a target="_blank" href="https://github.com/google/re2/wiki/Syntax">Regexp</a> is accepted)</label><div class="col-sm-10"><input type="text" id="endpoint_search" name="endpoint_search"placeholder="For example, 127.0.0.1" class="form-control" value="`)
-//line lib/promscrape/targetstatus.qtpl:135
+//line lib/promscrape/targetstatus.qtpl:136
 	qw422016.E().S(filter.endpointSearch)
-//line lib/promscrape/targetstatus.qtpl:135
+//line lib/promscrape/targetstatus.qtpl:136
 	qw422016.N().S(`"/></div></div><div class="form-group mb-3"><label for="label_search" class="col-sm-10 control-label">Labels filter (<a target="_blank" href="https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors">Arbitrary time series selectors</a> are accepted)</label><div class="col-sm-10"><input type="text" id="label_search" name="label_search"placeholder="For example, {instance=~'.+:9100'}" class="form-control" value="`)
-//line lib/promscrape/targetstatus.qtpl:142
+//line lib/promscrape/targetstatus.qtpl:143
 	qw422016.E().S(filter.labelSearch)
-//line lib/promscrape/targetstatus.qtpl:142
+//line lib/promscrape/targetstatus.qtpl:143
 	qw422016.N().S(`"/></div></div><input type="hidden" name="show_only_unhealthy" value="`)
-//line lib/promscrape/targetstatus.qtpl:145
+//line lib/promscrape/targetstatus.qtpl:146
 	qw422016.E().V(filter.showOnlyUnhealthy)
-//line lib/promscrape/targetstatus.qtpl:145
-	qw422016.N().S(`"/><input type="hidden" name="show_original_labels" value="`)
 //line lib/promscrape/targetstatus.qtpl:146
+	qw422016.N().S(`"/><input type="hidden" name="show_original_labels" value="`)
+//line lib/promscrape/targetstatus.qtpl:147
 	qw422016.E().V(filter.showOriginalLabels)
-//line lib/promscrape/targetstatus.qtpl:146
+//line lib/promscrape/targetstatus.qtpl:147
 	qw422016.N().S(`"/><button type="submit" class="btn btn-success mb-3">Submit</button><button type="button" class="btn btn-danger mb-3" onclick="location.href='?'">Clear target filters</button></form></div>`)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 }
 
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 func writefiltersForm(qq422016 qtio422016.Writer, filter *requestFilter) {
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	streamfiltersForm(qw422016, filter)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 }
 
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 func filtersForm(filter *requestFilter) string {
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	writefiltersForm(qb422016, filter)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:151
+//line lib/promscrape/targetstatus.qtpl:152
 }
 
-//line lib/promscrape/targetstatus.qtpl:153
+//line lib/promscrape/targetstatus.qtpl:154
 func streamtargetsTabs(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter, activeTab string) {
-//line lib/promscrape/targetstatus.qtpl:153
+//line lib/promscrape/targetstatus.qtpl:154
 	qw422016.N().S(`<ul class="nav nav-tabs" id="myTab" role="tablist"><li class="nav-item" role="presentation"><button class="nav-link`)
-//line lib/promscrape/targetstatus.qtpl:156
+//line lib/promscrape/targetstatus.qtpl:157
 	if activeTab == "scrapeTargets" {
-//line lib/promscrape/targetstatus.qtpl:156
+//line lib/promscrape/targetstatus.qtpl:157
 		qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:156
+//line lib/promscrape/targetstatus.qtpl:157
 		qw422016.N().S(`active`)
-//line lib/promscrape/targetstatus.qtpl:156
+//line lib/promscrape/targetstatus.qtpl:157
 	}
-//line lib/promscrape/targetstatus.qtpl:156
-	qw422016.N().S(`" type="button" role="tab"onclick="location.href='targets?`)
 //line lib/promscrape/targetstatus.qtpl:157
+	qw422016.N().S(`" type="button" role="tab"onclick="location.href='targets?`)
+//line lib/promscrape/targetstatus.qtpl:158
 	streamqueryArgs(qw422016, filter, nil)
-//line lib/promscrape/targetstatus.qtpl:157
+//line lib/promscrape/targetstatus.qtpl:158
 	qw422016.N().S(`'">Active targets</button></li><li class="nav-item" role="presentation"><button class="nav-link`)
-//line lib/promscrape/targetstatus.qtpl:162
+//line lib/promscrape/targetstatus.qtpl:163
 	if activeTab == "discoveredTargets" {
-//line lib/promscrape/targetstatus.qtpl:162
+//line lib/promscrape/targetstatus.qtpl:163
 		qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:162
+//line lib/promscrape/targetstatus.qtpl:163
 		qw422016.N().S(`active`)
-//line lib/promscrape/targetstatus.qtpl:162
+//line lib/promscrape/targetstatus.qtpl:163
 	}
-//line lib/promscrape/targetstatus.qtpl:162
-	qw422016.N().S(`" type="button" role="tab"onclick="location.href='service-discovery?`)
 //line lib/promscrape/targetstatus.qtpl:163
+	qw422016.N().S(`" type="button" role="tab"onclick="location.href='service-discovery?`)
+//line lib/promscrape/targetstatus.qtpl:164
 	streamqueryArgs(qw422016, filter, nil)
-//line lib/promscrape/targetstatus.qtpl:163
+//line lib/promscrape/targetstatus.qtpl:164
 	qw422016.N().S(`'">Discovered targets</button></li></ul><div class="tab-content"><div class="tab-pane active" role="tabpanel">`)
-//line lib/promscrape/targetstatus.qtpl:170
-	switch activeTab {
 //line lib/promscrape/targetstatus.qtpl:171
-	case "scrapeTargets":
+	switch activeTab {
 //line lib/promscrape/targetstatus.qtpl:172
-		streamscrapeTargets(qw422016, tsr)
+	case "scrapeTargets":
 //line lib/promscrape/targetstatus.qtpl:173
-	case "discoveredTargets":
+		streamscrapeTargets(qw422016, tsr)
 //line lib/promscrape/targetstatus.qtpl:174
-		streamdiscoveredTargets(qw422016, tsr)
+	case "discoveredTargets":
 //line lib/promscrape/targetstatus.qtpl:175
+		streamdiscoveredTargets(qw422016, tsr)
+//line lib/promscrape/targetstatus.qtpl:176
 	}
-//line lib/promscrape/targetstatus.qtpl:175
+//line lib/promscrape/targetstatus.qtpl:176
 	qw422016.N().S(`</div></div>`)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 }
 
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 func writetargetsTabs(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter, activeTab string) {
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	streamtargetsTabs(qw422016, tsr, filter, activeTab)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 }
 
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 func targetsTabs(tsr *targetsStatusResult, filter *requestFilter, activeTab string) string {
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	writetargetsTabs(qb422016, tsr, filter, activeTab)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:178
+//line lib/promscrape/targetstatus.qtpl:179
 }
 
-//line lib/promscrape/targetstatus.qtpl:180
+//line lib/promscrape/targetstatus.qtpl:181
 func streamscrapeTargets(qw422016 *qt422016.Writer, tsr *targetsStatusResult) {
-//line lib/promscrape/targetstatus.qtpl:180
+//line lib/promscrape/targetstatus.qtpl:181
 	qw422016.N().S(`<div class="row mt-4"><div class="col-12">`)
-//line lib/promscrape/targetstatus.qtpl:183
-	for i, jts := range tsr.jobTargetsStatuses {
 //line lib/promscrape/targetstatus.qtpl:184
-		streamscrapeJobTargets(qw422016, i, jts, tsr.hasOriginalLabels)
+	for i, jts := range tsr.jobTargetsStatuses {
 //line lib/promscrape/targetstatus.qtpl:185
-	}
+		streamscrapeJobTargets(qw422016, i, jts, tsr.hasOriginalLabels)
 //line lib/promscrape/targetstatus.qtpl:186
+	}
+//line lib/promscrape/targetstatus.qtpl:187
 	for i, jobName := range tsr.emptyJobs {
-//line lib/promscrape/targetstatus.qtpl:188
+//line lib/promscrape/targetstatus.qtpl:189
 		num := i + len(tsr.jobTargetsStatuses)
 		jts := &jobTargetsStatuses{
 			jobName: jobName,
 		}
 
-//line lib/promscrape/targetstatus.qtpl:193
-		streamscrapeJobTargets(qw422016, num, jts, tsr.hasOriginalLabels)
 //line lib/promscrape/targetstatus.qtpl:194
+		streamscrapeJobTargets(qw422016, num, jts, tsr.hasOriginalLabels)
+//line lib/promscrape/targetstatus.qtpl:195
 	}
-//line lib/promscrape/targetstatus.qtpl:194
+//line lib/promscrape/targetstatus.qtpl:195
 	qw422016.N().S(`</div></div>`)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 }
 
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 func writescrapeTargets(qq422016 qtio422016.Writer, tsr *targetsStatusResult) {
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	streamscrapeTargets(qw422016, tsr)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 }
 
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 func scrapeTargets(tsr *targetsStatusResult) string {
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	writescrapeTargets(qb422016, tsr)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:197
+//line lib/promscrape/targetstatus.qtpl:198
 }
 
-//line lib/promscrape/targetstatus.qtpl:199
+//line lib/promscrape/targetstatus.qtpl:200
 func streamscrapeJobTargets(qw422016 *qt422016.Writer, num int, jts *jobTargetsStatuses, hasOriginalLabels bool) {
-//line lib/promscrape/targetstatus.qtpl:199
+//line lib/promscrape/targetstatus.qtpl:200
 	qw422016.N().S(`<div class="row mb-4"><div class="col-12"><h4><span class="me-2">`)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.E().S(jts.jobName)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().S(`(`)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().D(jts.upCount)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().S(`/`)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().D(jts.targetsTotal)
-//line lib/promscrape/targetstatus.qtpl:203
+//line lib/promscrape/targetstatus.qtpl:204
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:203
-	qw422016.N().S(`up)</span>`)
 //line lib/promscrape/targetstatus.qtpl:204
+	qw422016.N().S(`up)</span>`)
+//line lib/promscrape/targetstatus.qtpl:205
 	streamshowHideScrapeJobButtons(qw422016, num)
-//line lib/promscrape/targetstatus.qtpl:204
+//line lib/promscrape/targetstatus.qtpl:205
 	qw422016.N().S(`</h4><div id="scrape-job-`)
-//line lib/promscrape/targetstatus.qtpl:206
+//line lib/promscrape/targetstatus.qtpl:207
 	qw422016.N().D(num)
-//line lib/promscrape/targetstatus.qtpl:206
+//line lib/promscrape/targetstatus.qtpl:207
 	qw422016.N().S(`" class="scrape-job table-responsive"><table class="table table-striped table-hover table-bordered table-sm"><thead><tr><th scope="col">Endpoint</th><th scope="col">State</th><th scope="col" title="target labels">Labels</th>`)
-//line lib/promscrape/targetstatus.qtpl:213
+//line lib/promscrape/targetstatus.qtpl:214
 	if hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:213
+//line lib/promscrape/targetstatus.qtpl:214
 		qw422016.N().S(`<th scope="col" title="debug relabeling">Debug relabeling</th>`)
-//line lib/promscrape/targetstatus.qtpl:215
+//line lib/promscrape/targetstatus.qtpl:216
 	}
-//line lib/promscrape/targetstatus.qtpl:215
-	qw422016.N().S(`<th scope="col" title="total scrapes">Scrapes</th><th scope="col" title="total scrape errors">Errors</th><th scope="col" title="the time of the last scrape">Last Scrape</th><th scope="col" title="the duration of the last scrape">Duration</th><th scope="col" title="the number of metrics scraped during the last scrape">Samples</th><th scope="col" title="error from the last scrape (if any)">Last error</th></tr></thead><tbody>`)
-//line lib/promscrape/targetstatus.qtpl:225
-	for _, ts := range jts.targetsStatus {
+//line lib/promscrape/targetstatus.qtpl:216
+	qw422016.N().S(`<th scope="col" title="total scrapes">Scrapes</th><th scope="col" title="total scrape errors">Errors</th><th scope="col" title="the time of the last scrape">Last Scrape</th><th scope="col" title="the duration of the last scrape">Duration</th><th scope="col" title="the size of the last scrape">Last Scrape Size</th><th scope="col" title="the number of metrics scraped during the last scrape">Samples</th><th scope="col" title="error from the last scrape (if any)">Last error</th></tr></thead><tbody>`)
 //line lib/promscrape/targetstatus.qtpl:227
+	for _, ts := range jts.targetsStatus {
+//line lib/promscrape/targetstatus.qtpl:229
 		endpoint := ts.sw.Config.ScrapeURL
 		originalLabels := ts.sw.Config.OriginalLabels
 
 		// The target is uniquely identified by a pointer to its original labels.
 		targetID := getLabelsID(originalLabels)
 
-//line lib/promscrape/targetstatus.qtpl:232
+//line lib/promscrape/targetstatus.qtpl:234
 		qw422016.N().S(`<tr`)
-//line lib/promscrape/targetstatus.qtpl:233
+//line lib/promscrape/targetstatus.qtpl:235
 		if !ts.up {
-//line lib/promscrape/targetstatus.qtpl:233
+//line lib/promscrape/targetstatus.qtpl:235
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:233
+//line lib/promscrape/targetstatus.qtpl:235
 			qw422016.N().S(`class="alert alert-danger" role="alert"`)
-//line lib/promscrape/targetstatus.qtpl:233
+//line lib/promscrape/targetstatus.qtpl:235
 		}
-//line lib/promscrape/targetstatus.qtpl:233
-		qw422016.N().S(`><td class="endpoint"><a href="`)
 //line lib/promscrape/targetstatus.qtpl:235
+		qw422016.N().S(`><td class="endpoint"><a href="`)
+//line lib/promscrape/targetstatus.qtpl:237
 		qw422016.E().S(endpoint)
-//line lib/promscrape/targetstatus.qtpl:235
+//line lib/promscrape/targetstatus.qtpl:237
 		qw422016.N().S(`" target="_blank">`)
-//line lib/promscrape/targetstatus.qtpl:235
+//line lib/promscrape/targetstatus.qtpl:237
 		qw422016.E().S(endpoint)
-//line lib/promscrape/targetstatus.qtpl:235
+//line lib/promscrape/targetstatus.qtpl:237
 		qw422016.N().S(`</a>`)
-//line lib/promscrape/targetstatus.qtpl:236
+//line lib/promscrape/targetstatus.qtpl:238
 		if hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:237
+//line lib/promscrape/targetstatus.qtpl:239
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:237
+//line lib/promscrape/targetstatus.qtpl:239
 			qw422016.N().S(`(<a href="target_response?id=`)
-//line lib/promscrape/targetstatus.qtpl:238
+//line lib/promscrape/targetstatus.qtpl:240
 			qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:238
-			qw422016.N().S(`" target="_blank"title="click to fetch target response on behalf of the scraper">response</a>)`)
 //line lib/promscrape/targetstatus.qtpl:240
+			qw422016.N().S(`" target="_blank"title="click to fetch target response on behalf of the scraper">response</a>)`)
+//line lib/promscrape/targetstatus.qtpl:242
 		}
-//line lib/promscrape/targetstatus.qtpl:240
+//line lib/promscrape/targetstatus.qtpl:242
 		qw422016.N().S(`</td><td>`)
-//line lib/promscrape/targetstatus.qtpl:243
+//line lib/promscrape/targetstatus.qtpl:245
 		if ts.up {
-//line lib/promscrape/targetstatus.qtpl:243
-			qw422016.N().S(`<span class="badge bg-success">UP</span>`)
 //line lib/promscrape/targetstatus.qtpl:245
+			qw422016.N().S(`<span class="badge bg-success">UP</span>`)
+//line lib/promscrape/targetstatus.qtpl:247
 		} else {
-//line lib/promscrape/targetstatus.qtpl:245
-			qw422016.N().S(`<span class="badge bg-danger">DOWN</span>`)
 //line lib/promscrape/targetstatus.qtpl:247
+			qw422016.N().S(`<span class="badge bg-danger">DOWN</span>`)
+//line lib/promscrape/targetstatus.qtpl:249
 		}
-//line lib/promscrape/targetstatus.qtpl:247
+//line lib/promscrape/targetstatus.qtpl:249
 		qw422016.N().S(`</td><td class="labels"><div`)
-//line lib/promscrape/targetstatus.qtpl:251
+//line lib/promscrape/targetstatus.qtpl:253
 		if hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:252
+//line lib/promscrape/targetstatus.qtpl:254
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:252
+//line lib/promscrape/targetstatus.qtpl:254
 			qw422016.N().S(`title="click to show original labels"onclick="document.getElementById('original-labels-`)
-//line lib/promscrape/targetstatus.qtpl:253
+//line lib/promscrape/targetstatus.qtpl:255
 			qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:253
+//line lib/promscrape/targetstatus.qtpl:255
 			qw422016.N().S(`').style.display='block'"`)
-//line lib/promscrape/targetstatus.qtpl:254
+//line lib/promscrape/targetstatus.qtpl:256
 		}
-//line lib/promscrape/targetstatus.qtpl:254
-		qw422016.N().S(`>`)
 //line lib/promscrape/targetstatus.qtpl:256
+		qw422016.N().S(`>`)
+//line lib/promscrape/targetstatus.qtpl:258
 		streamformatLabels(qw422016, ts.sw.Config.Labels)
-//line lib/promscrape/targetstatus.qtpl:256
-		qw422016.N().S(`</div>`)
 //line lib/promscrape/targetstatus.qtpl:258
+		qw422016.N().S(`</div>`)
+//line lib/promscrape/targetstatus.qtpl:260
 		if hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:258
+//line lib/promscrape/targetstatus.qtpl:260
 			qw422016.N().S(`<div style="display:none" id="original-labels-`)
-//line lib/promscrape/targetstatus.qtpl:259
+//line lib/promscrape/targetstatus.qtpl:261
 			qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:259
+//line lib/promscrape/targetstatus.qtpl:261
 			qw422016.N().S(`">`)
-//line lib/promscrape/targetstatus.qtpl:260
+//line lib/promscrape/targetstatus.qtpl:262
 			streamformatLabels(qw422016, originalLabels)
-//line lib/promscrape/targetstatus.qtpl:260
-			qw422016.N().S(`</div>`)
 //line lib/promscrape/targetstatus.qtpl:262
+			qw422016.N().S(`</div>`)
+//line lib/promscrape/targetstatus.qtpl:264
 		}
-//line lib/promscrape/targetstatus.qtpl:262
-		qw422016.N().S(`</td>`)
 //line lib/promscrape/targetstatus.qtpl:264
+		qw422016.N().S(`</td>`)
+//line lib/promscrape/targetstatus.qtpl:266
 		if hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:264
-			qw422016.N().S(`<td><a href="target-relabel-debug?id=`)
 //line lib/promscrape/targetstatus.qtpl:266
+			qw422016.N().S(`<td><a href="target-relabel-debug?id=`)
+//line lib/promscrape/targetstatus.qtpl:268
 			qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:266
+//line lib/promscrape/targetstatus.qtpl:268
 			qw422016.N().S(`" target="_blank">target</a>`)
-//line lib/promscrape/targetstatus.qtpl:266
+//line lib/promscrape/targetstatus.qtpl:268
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:266
+//line lib/promscrape/targetstatus.qtpl:268
 			qw422016.N().S(`<a href="metric-relabel-debug?id=`)
-//line lib/promscrape/targetstatus.qtpl:267
+//line lib/promscrape/targetstatus.qtpl:269
 			qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:267
-			qw422016.N().S(`" target="_blank">metrics</a></td>`)
 //line lib/promscrape/targetstatus.qtpl:269
+			qw422016.N().S(`" target="_blank">metrics</a></td>`)
+//line lib/promscrape/targetstatus.qtpl:271
 		}
-//line lib/promscrape/targetstatus.qtpl:269
+//line lib/promscrape/targetstatus.qtpl:271
 		qw422016.N().S(`<td>`)
-//line lib/promscrape/targetstatus.qtpl:270
+//line lib/promscrape/targetstatus.qtpl:272
 		qw422016.N().D(ts.scrapesTotal)
-//line lib/promscrape/targetstatus.qtpl:270
+//line lib/promscrape/targetstatus.qtpl:272
 		qw422016.N().S(`</td><td>`)
-//line lib/promscrape/targetstatus.qtpl:271
+//line lib/promscrape/targetstatus.qtpl:273
 		qw422016.N().D(ts.scrapesFailed)
-//line lib/promscrape/targetstatus.qtpl:271
+//line lib/promscrape/targetstatus.qtpl:273
 		qw422016.N().S(`</td><td>`)
-//line lib/promscrape/targetstatus.qtpl:272
+//line lib/promscrape/targetstatus.qtpl:274
 		qw422016.E().S(ts.getDurationFromLastScrape())
-//line lib/promscrape/targetstatus.qtpl:272
-		qw422016.N().S(`<td>`)
-//line lib/promscrape/targetstatus.qtpl:273
+//line lib/promscrape/targetstatus.qtpl:274
+		qw422016.N().S(`</td><td>`)
+//line lib/promscrape/targetstatus.qtpl:275
 		qw422016.N().D(int(ts.scrapeDuration))
-//line lib/promscrape/targetstatus.qtpl:273
+//line lib/promscrape/targetstatus.qtpl:275
 		qw422016.N().S(`ms</td><td>`)
-//line lib/promscrape/targetstatus.qtpl:274
+//line lib/promscrape/targetstatus.qtpl:276
+		qw422016.E().S(ts.getSizeFromLastScrape())
+//line lib/promscrape/targetstatus.qtpl:276
+		qw422016.N().S(`</td><td>`)
+//line lib/promscrape/targetstatus.qtpl:277
 		qw422016.N().D(ts.samplesScraped)
-//line lib/promscrape/targetstatus.qtpl:274
+//line lib/promscrape/targetstatus.qtpl:277
 		qw422016.N().S(`</td><td>`)
-//line lib/promscrape/targetstatus.qtpl:275
+//line lib/promscrape/targetstatus.qtpl:278
 		if ts.err != nil {
-//line lib/promscrape/targetstatus.qtpl:275
+//line lib/promscrape/targetstatus.qtpl:278
 			qw422016.E().S(ts.err.Error())
-//line lib/promscrape/targetstatus.qtpl:275
+//line lib/promscrape/targetstatus.qtpl:278
 		}
-//line lib/promscrape/targetstatus.qtpl:275
+//line lib/promscrape/targetstatus.qtpl:278
 		qw422016.N().S(`</td></tr>`)
-//line lib/promscrape/targetstatus.qtpl:277
+//line lib/promscrape/targetstatus.qtpl:280
 	}
-//line lib/promscrape/targetstatus.qtpl:277
+//line lib/promscrape/targetstatus.qtpl:280
 	qw422016.N().S(`</tbody></table></div></div></div>`)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 }
 
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 func writescrapeJobTargets(qq422016 qtio422016.Writer, num int, jts *jobTargetsStatuses, hasOriginalLabels bool) {
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	streamscrapeJobTargets(qw422016, num, jts, hasOriginalLabels)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 }
 
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 func scrapeJobTargets(num int, jts *jobTargetsStatuses, hasOriginalLabels bool) string {
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	writescrapeJobTargets(qb422016, num, jts, hasOriginalLabels)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:283
+//line lib/promscrape/targetstatus.qtpl:286
 }
 
-//line lib/promscrape/targetstatus.qtpl:285
+//line lib/promscrape/targetstatus.qtpl:288
 func streamdiscoveredTargets(qw422016 *qt422016.Writer, tsr *targetsStatusResult) {
-//line lib/promscrape/targetstatus.qtpl:286
+//line lib/promscrape/targetstatus.qtpl:289
 	if !tsr.hasOriginalLabels {
-//line lib/promscrape/targetstatus.qtpl:286
+//line lib/promscrape/targetstatus.qtpl:289
 		qw422016.N().S(`<div class="alert alert-warning" role="alert">Discovered targets are unavailable when <b>-promscrape.dropOriginalLabels</b> command-line flag is set</div>`)
-//line lib/promscrape/targetstatus.qtpl:290
+//line lib/promscrape/targetstatus.qtpl:293
 		return
-//line lib/promscrape/targetstatus.qtpl:291
+//line lib/promscrape/targetstatus.qtpl:294
 	}
-//line lib/promscrape/targetstatus.qtpl:293
+//line lib/promscrape/targetstatus.qtpl:296
 	if n := droppedTargetsMap.getTotalTargets(); n > *maxDroppedTargets {
-//line lib/promscrape/targetstatus.qtpl:293
+//line lib/promscrape/targetstatus.qtpl:296
 		qw422016.N().S(`<div class="alert alert-warning" role="alert">Dropped targets' list below is incomplete, because the number of dropped targets exceeds <b>-promscrape.maxDroppedTargets=`)
-//line lib/promscrape/targetstatus.qtpl:295
+//line lib/promscrape/targetstatus.qtpl:298
 		qw422016.N().D(*maxDroppedTargets)
-//line lib/promscrape/targetstatus.qtpl:295
+//line lib/promscrape/targetstatus.qtpl:298
 		qw422016.N().S(`</b>.<br/>If you want to see the full list of dropped targets, then increase <b>-promscrape.maxDroppedTargets</b> command-line flag value to at least`)
-//line lib/promscrape/targetstatus.qtpl:296
+//line lib/promscrape/targetstatus.qtpl:299
 		qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:296
+//line lib/promscrape/targetstatus.qtpl:299
 		qw422016.N().S(`<b>`)
-//line lib/promscrape/targetstatus.qtpl:296
+//line lib/promscrape/targetstatus.qtpl:299
 		qw422016.N().D(n)
-//line lib/promscrape/targetstatus.qtpl:296
-		qw422016.N().S(`</b>.<br/>Note that this may increase memory usage.</div>`)
 //line lib/promscrape/targetstatus.qtpl:299
+		qw422016.N().S(`</b>.<br/>Note that this may increase memory usage.</div>`)
+//line lib/promscrape/targetstatus.qtpl:302
 	}
-//line lib/promscrape/targetstatus.qtpl:301
+//line lib/promscrape/targetstatus.qtpl:304
 	tljs := tsr.getTargetLabelsByJob()
 
-//line lib/promscrape/targetstatus.qtpl:301
-	qw422016.N().S(`<div class="row mt-4"><div class="col-12">`)
 //line lib/promscrape/targetstatus.qtpl:304
+	qw422016.N().S(`<div class="row mt-4"><div class="col-12">`)
+//line lib/promscrape/targetstatus.qtpl:307
 	for i, tlj := range tljs {
-//line lib/promscrape/targetstatus.qtpl:305
+//line lib/promscrape/targetstatus.qtpl:308
 		streamdiscoveredJobTargets(qw422016, i, tlj)
-//line lib/promscrape/targetstatus.qtpl:306
+//line lib/promscrape/targetstatus.qtpl:309
 	}
-//line lib/promscrape/targetstatus.qtpl:306
-	qw422016.N().S(`</div></div>`)
 //line lib/promscrape/targetstatus.qtpl:309
+	qw422016.N().S(`</div></div>`)
+//line lib/promscrape/targetstatus.qtpl:312
 }
 
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 func writediscoveredTargets(qq422016 qtio422016.Writer, tsr *targetsStatusResult) {
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	streamdiscoveredTargets(qw422016, tsr)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 }
 
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 func discoveredTargets(tsr *targetsStatusResult) string {
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	writediscoveredTargets(qb422016, tsr)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:309
+//line lib/promscrape/targetstatus.qtpl:312
 }
 
-//line lib/promscrape/targetstatus.qtpl:311
+//line lib/promscrape/targetstatus.qtpl:314
 func streamdiscoveredJobTargets(qw422016 *qt422016.Writer, num int, tlj *targetLabelsByJob) {
-//line lib/promscrape/targetstatus.qtpl:311
+//line lib/promscrape/targetstatus.qtpl:314
 	qw422016.N().S(`<h4><span class="me-2">`)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.E().S(tlj.jobName)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().S(`(`)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().D(tlj.activeTargets)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().S(`/`)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().D(tlj.activeTargets + tlj.droppedTargets)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:313
+//line lib/promscrape/targetstatus.qtpl:316
 	qw422016.N().S(`active)</span>`)
-//line lib/promscrape/targetstatus.qtpl:314
+//line lib/promscrape/targetstatus.qtpl:317
 	streamshowHideScrapeJobButtons(qw422016, num)
-//line lib/promscrape/targetstatus.qtpl:314
+//line lib/promscrape/targetstatus.qtpl:317
 	qw422016.N().S(`</h4><div id="scrape-job-`)
-//line lib/promscrape/targetstatus.qtpl:316
+//line lib/promscrape/targetstatus.qtpl:319
 	qw422016.N().D(num)
-//line lib/promscrape/targetstatus.qtpl:316
+//line lib/promscrape/targetstatus.qtpl:319
 	qw422016.N().S(`" class="scrape-job table-responsive"><table class="table table-striped table-hover table-bordered table-sm"><thead><tr><th scope="col" style="width: 5%">Status</th><th scope="col" style="width: 60%">Discovered Labels</th><th scope="col" style="width: 30%">Target Labels</th><th scope="col" stile="width: 5%">Debug relabeling</a></tr></thead><tbody>`)
-//line lib/promscrape/targetstatus.qtpl:327
+//line lib/promscrape/targetstatus.qtpl:330
 	for _, t := range tlj.targets {
-//line lib/promscrape/targetstatus.qtpl:327
+//line lib/promscrape/targetstatus.qtpl:330
 		qw422016.N().S(`<tr`)
-//line lib/promscrape/targetstatus.qtpl:329
+//line lib/promscrape/targetstatus.qtpl:332
 		if !t.up {
-//line lib/promscrape/targetstatus.qtpl:330
+//line lib/promscrape/targetstatus.qtpl:333
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:330
+//line lib/promscrape/targetstatus.qtpl:333
 			qw422016.N().S(`role="alert"`)
-//line lib/promscrape/targetstatus.qtpl:330
+//line lib/promscrape/targetstatus.qtpl:333
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:331
+//line lib/promscrape/targetstatus.qtpl:334
 			if t.labels.Len() > 0 {
-//line lib/promscrape/targetstatus.qtpl:331
+//line lib/promscrape/targetstatus.qtpl:334
 				qw422016.N().S(`class="alert alert-danger"`)
-//line lib/promscrape/targetstatus.qtpl:333
+//line lib/promscrape/targetstatus.qtpl:336
 			} else {
-//line lib/promscrape/targetstatus.qtpl:333
+//line lib/promscrape/targetstatus.qtpl:336
 				qw422016.N().S(`class="alert alert-warning"`)
-//line lib/promscrape/targetstatus.qtpl:335
+//line lib/promscrape/targetstatus.qtpl:338
 			}
-//line lib/promscrape/targetstatus.qtpl:336
+//line lib/promscrape/targetstatus.qtpl:339
 		}
-//line lib/promscrape/targetstatus.qtpl:336
-		qw422016.N().S(`><td>`)
 //line lib/promscrape/targetstatus.qtpl:339
+		qw422016.N().S(`><td>`)
+//line lib/promscrape/targetstatus.qtpl:342
 		if t.up {
-//line lib/promscrape/targetstatus.qtpl:339
+//line lib/promscrape/targetstatus.qtpl:342
 			qw422016.N().S(`<span class="badge bg-success">UP</span>`)
-//line lib/promscrape/targetstatus.qtpl:341
+//line lib/promscrape/targetstatus.qtpl:344
 		} else if t.labels.Len() > 0 {
-//line lib/promscrape/targetstatus.qtpl:341
+//line lib/promscrape/targetstatus.qtpl:344
 			qw422016.N().S(`<span class="badge bg-danger">DOWN</span>`)
-//line lib/promscrape/targetstatus.qtpl:343
+//line lib/promscrape/targetstatus.qtpl:346
 		} else {
-//line lib/promscrape/targetstatus.qtpl:343
+//line lib/promscrape/targetstatus.qtpl:346
 			qw422016.N().S(`<span class="badge bg-warning">DROPPED (`)
-//line lib/promscrape/targetstatus.qtpl:344
+//line lib/promscrape/targetstatus.qtpl:347
 			qw422016.E().S(string(t.dropReason))
-//line lib/promscrape/targetstatus.qtpl:344
+//line lib/promscrape/targetstatus.qtpl:347
 			qw422016.N().S(`)</span>`)
-//line lib/promscrape/targetstatus.qtpl:345
+//line lib/promscrape/targetstatus.qtpl:348
 			if len(t.clusterMemberNums) > 0 {
-//line lib/promscrape/targetstatus.qtpl:345
-				qw422016.N().S(`<br/><span title="The target exists at vmagent instances with the given -promscrape.cluster.memberNum values">exists at`)
 //line lib/promscrape/targetstatus.qtpl:348
+				qw422016.N().S(`<br/><span title="The target exists at vmagent instances with the given -promscrape.cluster.memberNum values">exists at`)
+//line lib/promscrape/targetstatus.qtpl:351
 				qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:349
+//line lib/promscrape/targetstatus.qtpl:352
 				for i, memberNum := range t.clusterMemberNums {
-//line lib/promscrape/targetstatus.qtpl:350
+//line lib/promscrape/targetstatus.qtpl:353
 					if *clusterMemberURLTemplate == "" {
-//line lib/promscrape/targetstatus.qtpl:350
+//line lib/promscrape/targetstatus.qtpl:353
 						qw422016.N().S(`shard-`)
-//line lib/promscrape/targetstatus.qtpl:351
+//line lib/promscrape/targetstatus.qtpl:354
 						qw422016.N().D(memberNum)
-//line lib/promscrape/targetstatus.qtpl:352
+//line lib/promscrape/targetstatus.qtpl:355
 					} else {
-//line lib/promscrape/targetstatus.qtpl:352
+//line lib/promscrape/targetstatus.qtpl:355
 						qw422016.N().S(`<a href="`)
-//line lib/promscrape/targetstatus.qtpl:353
+//line lib/promscrape/targetstatus.qtpl:356
 						qw422016.E().S(strings.ReplaceAll(*clusterMemberURLTemplate, "%d", strconv.Itoa(memberNum)))
-//line lib/promscrape/targetstatus.qtpl:353
+//line lib/promscrape/targetstatus.qtpl:356
 						qw422016.N().S(`" target="_blank">shard-`)
-//line lib/promscrape/targetstatus.qtpl:353
+//line lib/promscrape/targetstatus.qtpl:356
 						qw422016.N().D(memberNum)
-//line lib/promscrape/targetstatus.qtpl:353
+//line lib/promscrape/targetstatus.qtpl:356
 						qw422016.N().S(`</a>`)
-//line lib/promscrape/targetstatus.qtpl:354
+//line lib/promscrape/targetstatus.qtpl:357
 					}
-//line lib/promscrape/targetstatus.qtpl:355
+//line lib/promscrape/targetstatus.qtpl:358
 					if i+1 < len(t.clusterMemberNums) {
-//line lib/promscrape/targetstatus.qtpl:355
+//line lib/promscrape/targetstatus.qtpl:358
 						qw422016.N().S(`,`)
-//line lib/promscrape/targetstatus.qtpl:355
+//line lib/promscrape/targetstatus.qtpl:358
 						qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:355
+//line lib/promscrape/targetstatus.qtpl:358
 					}
-//line lib/promscrape/targetstatus.qtpl:356
+//line lib/promscrape/targetstatus.qtpl:359
 				}
-//line lib/promscrape/targetstatus.qtpl:357
+//line lib/promscrape/targetstatus.qtpl:360
 			}
-//line lib/promscrape/targetstatus.qtpl:358
-		}
-//line lib/promscrape/targetstatus.qtpl:358
-		qw422016.N().S(`</td><td class="labels">`)
 //line lib/promscrape/targetstatus.qtpl:361
-		streamformatLabels(qw422016, t.originalLabels)
+		}
 //line lib/promscrape/targetstatus.qtpl:361
 		qw422016.N().S(`</td><td class="labels">`)
 //line lib/promscrape/targetstatus.qtpl:364
-		streamformatLabels(qw422016, t.labels)
+		streamformatLabels(qw422016, t.originalLabels)
 //line lib/promscrape/targetstatus.qtpl:364
-		qw422016.N().S(`</td><td>`)
+		qw422016.N().S(`</td><td class="labels">`)
 //line lib/promscrape/targetstatus.qtpl:367
+		streamformatLabels(qw422016, t.labels)
+//line lib/promscrape/targetstatus.qtpl:367
+		qw422016.N().S(`</td><td>`)
+//line lib/promscrape/targetstatus.qtpl:370
 		targetID := getLabelsID(t.originalLabels)
 
-//line lib/promscrape/targetstatus.qtpl:367
+//line lib/promscrape/targetstatus.qtpl:370
 		qw422016.N().S(`<a href="target-relabel-debug?id=`)
-//line lib/promscrape/targetstatus.qtpl:368
+//line lib/promscrape/targetstatus.qtpl:371
 		qw422016.E().S(targetID)
-//line lib/promscrape/targetstatus.qtpl:368
-		qw422016.N().S(`" target="_blank">debug</a></td></tr>`)
 //line lib/promscrape/targetstatus.qtpl:371
+		qw422016.N().S(`" target="_blank">debug</a></td></tr>`)
+//line lib/promscrape/targetstatus.qtpl:374
 	}
-//line lib/promscrape/targetstatus.qtpl:371
+//line lib/promscrape/targetstatus.qtpl:374
 	qw422016.N().S(`</tbody></table></div>`)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 }
 
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 func writediscoveredJobTargets(qq422016 qtio422016.Writer, num int, tlj *targetLabelsByJob) {
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	streamdiscoveredJobTargets(qw422016, num, tlj)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 }
 
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 func discoveredJobTargets(num int, tlj *targetLabelsByJob) string {
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	writediscoveredJobTargets(qb422016, num, tlj)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:375
+//line lib/promscrape/targetstatus.qtpl:378
 }
 
-//line lib/promscrape/targetstatus.qtpl:377
+//line lib/promscrape/targetstatus.qtpl:380
 func streamshowHideScrapeJobButtons(qw422016 *qt422016.Writer, num int) {
-//line lib/promscrape/targetstatus.qtpl:377
+//line lib/promscrape/targetstatus.qtpl:380
 	qw422016.N().S(`<button type="button" class="btn btn-primary btn-sm me-1"onclick="document.getElementById('scrape-job-`)
-//line lib/promscrape/targetstatus.qtpl:379
+//line lib/promscrape/targetstatus.qtpl:382
 	qw422016.N().D(num)
-//line lib/promscrape/targetstatus.qtpl:379
+//line lib/promscrape/targetstatus.qtpl:382
 	qw422016.N().S(`').style.display='none'">collapse</button><button type="button" class="btn btn-secondary btn-sm me-1"onclick="document.getElementById('scrape-job-`)
-//line lib/promscrape/targetstatus.qtpl:383
+//line lib/promscrape/targetstatus.qtpl:386
 	qw422016.N().D(num)
-//line lib/promscrape/targetstatus.qtpl:383
-	qw422016.N().S(`').style.display='block'">expand</button>`)
 //line lib/promscrape/targetstatus.qtpl:386
+	qw422016.N().S(`').style.display='block'">expand</button>`)
+//line lib/promscrape/targetstatus.qtpl:389
 }
 
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 func writeshowHideScrapeJobButtons(qq422016 qtio422016.Writer, num int) {
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	streamshowHideScrapeJobButtons(qw422016, num)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 }
 
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 func showHideScrapeJobButtons(num int) string {
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	writeshowHideScrapeJobButtons(qb422016, num)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:386
+//line lib/promscrape/targetstatus.qtpl:389
 }
 
-//line lib/promscrape/targetstatus.qtpl:388
+//line lib/promscrape/targetstatus.qtpl:391
 func streamqueryArgs(qw422016 *qt422016.Writer, filter *requestFilter, override map[string]string) {
-//line lib/promscrape/targetstatus.qtpl:390
+//line lib/promscrape/targetstatus.qtpl:393
 	showOnlyUnhealthy := "false"
 	if filter.showOnlyUnhealthy {
 		showOnlyUnhealthy = "true"
@@ -1043,89 +1055,89 @@ func streamqueryArgs(qw422016 *qt422016.Writer, filter *requestFilter, override
 		qa[k] = []string{v}
 	}
 
-//line lib/promscrape/targetstatus.qtpl:407
+//line lib/promscrape/targetstatus.qtpl:410
 	qw422016.E().S(qa.Encode())
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 }
 
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 func writequeryArgs(qq422016 qtio422016.Writer, filter *requestFilter, override map[string]string) {
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	streamqueryArgs(qw422016, filter, override)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 }
 
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 func queryArgs(filter *requestFilter, override map[string]string) string {
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	writequeryArgs(qb422016, filter, override)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:408
+//line lib/promscrape/targetstatus.qtpl:411
 }
 
-//line lib/promscrape/targetstatus.qtpl:410
+//line lib/promscrape/targetstatus.qtpl:413
 func streamformatLabels(qw422016 *qt422016.Writer, labels *promutils.Labels) {
-//line lib/promscrape/targetstatus.qtpl:411
+//line lib/promscrape/targetstatus.qtpl:414
 	labelsList := labels.GetLabels()
 
-//line lib/promscrape/targetstatus.qtpl:411
+//line lib/promscrape/targetstatus.qtpl:414
 	qw422016.N().S(`{`)
-//line lib/promscrape/targetstatus.qtpl:413
+//line lib/promscrape/targetstatus.qtpl:416
 	for i, label := range labelsList {
-//line lib/promscrape/targetstatus.qtpl:414
+//line lib/promscrape/targetstatus.qtpl:417
 		qw422016.E().S(label.Name)
-//line lib/promscrape/targetstatus.qtpl:414
+//line lib/promscrape/targetstatus.qtpl:417
 		qw422016.N().S(`=`)
-//line lib/promscrape/targetstatus.qtpl:414
+//line lib/promscrape/targetstatus.qtpl:417
 		qw422016.E().Q(label.Value)
-//line lib/promscrape/targetstatus.qtpl:415
+//line lib/promscrape/targetstatus.qtpl:418
 		if i+1 < len(labelsList) {
-//line lib/promscrape/targetstatus.qtpl:415
+//line lib/promscrape/targetstatus.qtpl:418
 			qw422016.N().S(`,`)
-//line lib/promscrape/targetstatus.qtpl:415
+//line lib/promscrape/targetstatus.qtpl:418
 			qw422016.N().S(` `)
-//line lib/promscrape/targetstatus.qtpl:415
+//line lib/promscrape/targetstatus.qtpl:418
 		}
-//line lib/promscrape/targetstatus.qtpl:416
+//line lib/promscrape/targetstatus.qtpl:419
 	}
-//line lib/promscrape/targetstatus.qtpl:416
+//line lib/promscrape/targetstatus.qtpl:419
 	qw422016.N().S(`}`)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 }
 
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 func writeformatLabels(qq422016 qtio422016.Writer, labels *promutils.Labels) {
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	qw422016 := qt422016.AcquireWriter(qq422016)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	streamformatLabels(qw422016, labels)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	qt422016.ReleaseWriter(qw422016)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 }
 
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 func formatLabels(labels *promutils.Labels) string {
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	qb422016 := qt422016.AcquireByteBuffer()
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	writeformatLabels(qb422016, labels)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	qs422016 := string(qb422016.B)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	qt422016.ReleaseByteBuffer(qb422016)
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 	return qs422016
-//line lib/promscrape/targetstatus.qtpl:418
+//line lib/promscrape/targetstatus.qtpl:421
 }


Test patch:
diff --git a/lib/promscrape/config_test.go b/lib/promscrape/config_test.go
index 437d5e27e..ac1b12146 100644
--- a/lib/promscrape/config_test.go
+++ b/lib/promscrape/config_test.go
@@ -227,6 +227,7 @@ scrape_configs:
 			ScrapeURL:      "http://host1:80/metric/path1?x=y",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host1:80",
 				"job":      "abc",
@@ -237,6 +238,7 @@ scrape_configs:
 			ScrapeURL:      "https://host2:443/metric/path2?x=y",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host2:443",
 				"job":      "abc",
@@ -247,6 +249,7 @@ scrape_configs:
 			ScrapeURL:      "http://host3:1234/metric/path3?arg1=value1&x=y",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host3:1234",
 				"job":      "abc",
@@ -257,6 +260,7 @@ scrape_configs:
 			ScrapeURL:      "https://host4:1234/foo/bar?x=y",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host4:1234",
 				"job":      "abc",
@@ -295,6 +299,7 @@ scrape_configs:
 		ScrapeURL:      "http://black:9115/probe?module=dns_udp_example&target=8.8.8.8",
 		ScrapeInterval: defaultScrapeInterval,
 		ScrapeTimeout:  defaultScrapeTimeout,
+		MaxScrapeSize:  maxScrapeSize.N,
 		Labels: promutils.NewLabelsFromMap(map[string]string{
 			"instance": "8.8.8.8",
 			"job":      "blackbox",
@@ -457,6 +462,7 @@ scrape_configs:
 			ScrapeURL:      "http://host1:80/abc/de",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host1:80",
 				"job":      "foo",
@@ -468,6 +474,7 @@ scrape_configs:
 			ScrapeURL:      "http://host2:80/abc/de",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "host2:80",
 				"job":      "foo",
@@ -479,6 +486,7 @@ scrape_configs:
 			ScrapeURL:      "http://localhost:9090/abc/de",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "localhost:9090",
 				"job":      "foo",
@@ -685,6 +693,7 @@ scrape_configs:
 			ScrapeURL:      "http://s:80/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "s:80",
 				"job":      "aa",
@@ -706,6 +715,7 @@ scrape_configs:
 			ScrapeURL:      "http://s:80/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "s:80",
 				"job":      "aa",
@@ -727,6 +737,7 @@ scrape_configs:
 			ScrapeURL:      "http://s:80/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "s:80",
 				"job":      "aa",
@@ -748,6 +759,7 @@ scrape_configs:
 			ScrapeURL:      "http://s:80/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "s:80",
 				"job":      "aa",
@@ -766,6 +778,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "foo",
@@ -787,6 +800,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "foo",
@@ -834,6 +848,7 @@ scrape_configs:
 			ScrapeURL:       "https://foo.bar:443/foo/bar?p=x%26y&p=%3D",
 			ScrapeInterval:  54 * time.Second,
 			ScrapeTimeout:   5 * time.Second,
+			MaxScrapeSize:   maxScrapeSize.N,
 			HonorLabels:     true,
 			HonorTimestamps: true,
 			DenyRedirects:   true,
@@ -849,6 +864,7 @@ scrape_configs:
 			ScrapeURL:       "https://aaa:443/foo/bar?p=x%26y&p=%3D",
 			ScrapeInterval:  54 * time.Second,
 			ScrapeTimeout:   5 * time.Second,
+			MaxScrapeSize:   maxScrapeSize.N,
 			HonorLabels:     true,
 			HonorTimestamps: true,
 			DenyRedirects:   true,
@@ -864,6 +880,7 @@ scrape_configs:
 			ScrapeURL:      "http://1.2.3.4:80/metrics",
 			ScrapeInterval: 8 * time.Second,
 			ScrapeTimeout:  8 * time.Second,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "1.2.3.4:80",
 				"job":      "qwer",
@@ -874,6 +891,7 @@ scrape_configs:
 			ScrapeURL:      "http://foobar:80/metrics",
 			ScrapeInterval: 8 * time.Second,
 			ScrapeTimeout:  8 * time.Second,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foobar:80",
 				"job":      "asdf",
@@ -921,6 +939,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics?x=keep_me",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"hash":       "82",
 				"instance":   "foo.bar:1234",
@@ -962,6 +981,7 @@ scrape_configs:
 			ScrapeURL:      "mailto://foo.bar:1234/abc.de?a=b",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "fake.addr",
 				"job":      "https",
@@ -973,6 +993,7 @@ scrape_configs:
 scrape_configs:
 - job_name: foo
   scheme: https
+  max_scrape_size: 0
   relabel_configs:
   - action: keep
     source_labels: [__address__]
@@ -994,6 +1015,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  0,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "3",
@@ -1005,6 +1027,7 @@ scrape_configs:
 	f(`
 scrape_configs:
 - job_name: foo
+  max_scrape_size: 8MiB
   metric_relabel_configs:
   - source_labels: [foo]
     target_label: abc
@@ -1015,6 +1038,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  8 * 1024 * 1024,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "foo",
@@ -1032,6 +1056,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "foo",
@@ -1049,6 +1074,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metrics",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "foo",
@@ -1080,6 +1106,7 @@ scrape_configs:
 			ScrapeURL:      "http://pp:80/metrics?a=c&a=xy",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"foo":      "bar",
 				"instance": "pp:80",
@@ -1130,6 +1157,7 @@ scrape_configs:
 			ScrapeURL:      "http://127.0.0.1:9116/snmp?module=if_mib&target=192.168.1.2",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "192.168.1.2",
 				"job":      "snmp",
@@ -1158,6 +1186,7 @@ scrape_configs:
 			ScrapeURL:      "http://foo.bar:1234/metricspath",
 			ScrapeInterval: defaultScrapeInterval,
 			ScrapeTimeout:  defaultScrapeTimeout,
+			MaxScrapeSize:  maxScrapeSize.N,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
 				"job":      "path wo slash",
@@ -1184,6 +1213,7 @@ scrape_configs:
 			ScrapeTimeout:       time.Hour * 24,
 			ScrapeAlignInterval: time.Hour * 24,
 			ScrapeOffset:        time.Hour * 24 * 2,
+			MaxScrapeSize:       maxScrapeSize.N,
 			NoStaleMarkers:      true,
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
@@ -1206,6 +1236,7 @@ scrape_configs:
 			ScrapeURL:       "http://foo.bar:1234/metrics",
 			ScrapeInterval:  defaultScrapeInterval,
 			ScrapeTimeout:   defaultScrapeTimeout,
+			MaxScrapeSize:   maxScrapeSize.N,
 			jobNameOriginal: "foo",
 			Labels: promutils.NewLabelsFromMap(map[string]string{
 				"instance": "foo.bar:1234",
diff --git a/lib/promscrape/scrapework_test.go b/lib/promscrape/scrapework_test.go
index a4a972c62..1435ba2aa 100644
--- a/lib/promscrape/scrapework_test.go
+++ b/lib/promscrape/scrapework_test.go
@@ -77,6 +77,7 @@ func TestScrapeWorkScrapeInternalFailure(t *testing.T) {
 	dataExpected := `
 		up 0 123
 		scrape_samples_scraped 0 123
+		scrape_response_size_bytes 0 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 0 123
 		scrape_series_added 0 123
@@ -181,6 +182,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 	}, `
 		up 1 123
 		scrape_samples_scraped 0 123
+		scrape_response_size_bytes 0 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 0 123
 		scrape_series_added 0 123
@@ -196,6 +198,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		abc -2 123
 		up 1 123
 		scrape_samples_scraped 2 123
+		scrape_response_size_bytes 51 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 2 123
 		scrape_series_added 2 123
@@ -215,6 +218,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		abc{foo="x"} -2 123
 		up{foo="x"} 1 123
 		scrape_samples_scraped{foo="x"} 2 123
+		scrape_response_size_bytes{foo="x"} 36 123
 		scrape_duration_seconds{foo="x"} 0 123
 		scrape_samples_post_metric_relabeling{foo="x"} 2 123
 		scrape_series_added{foo="x"} 2 123
@@ -234,6 +238,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		bar{exported_job="aa",job="override",x="1",a="b",y="2"} -3e4 123
 		up{job="override"} 1 123
 		scrape_samples_scraped{job="override"} 2 123
+		scrape_response_size_bytes{job="override"} 80 123
 		scrape_duration_seconds{job="override"} 0 123
 		scrape_samples_post_metric_relabeling{job="override"} 2 123
 		scrape_series_added{job="override"} 2 123
@@ -255,6 +260,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		test_with_instance{instance="some_instance",job="some_job",label="val2"} 1555 123
 		up{instance="foobar",job="xxx"} 1 123
 		scrape_samples_scraped{instance="foobar",job="xxx"} 2 123
+		scrape_response_size_bytes{instance="foobar",job="xxx"} 158 123
 		scrape_duration_seconds{instance="foobar",job="xxx"} 0 123
 		scrape_samples_post_metric_relabeling{instance="foobar",job="xxx"} 2 123
 		scrape_series_added{instance="foobar",job="xxx"} 2 123
@@ -275,6 +281,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		test_with_instance{exported_instance="some_instance",exported_job="some_job",instance="foobar",job="xxx",label="val2"} 1555 123
 		up{instance="foobar",job="xxx"} 1 123
 		scrape_samples_scraped{instance="foobar",job="xxx"} 2 123
+		scrape_response_size_bytes{instance="foobar",job="xxx"} 158 123
 		scrape_duration_seconds{instance="foobar",job="xxx"} 0 123
 		scrape_samples_post_metric_relabeling{instance="foobar",job="xxx"} 2 123
 		scrape_series_added{instance="foobar",job="xxx"} 2 123
@@ -294,6 +301,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		bar{job="aa",a="b"} -3e4 123
 		up{job="override"} 1 123
 		scrape_samples_scraped{job="override"} 2 123
+		scrape_response_size_bytes{job="override"} 68 123
 		scrape_duration_seconds{job="override"} 0 123
 		scrape_samples_post_metric_relabeling{job="override"} 2 123
 		scrape_series_added{job="override"} 2 123
@@ -322,6 +330,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		bar{a="b",job="xx",instance="foo.com/xx"} -3e4 123
 		up{job="xx"} 1 123
 		scrape_samples_scraped{job="xx"} 2 123
+		scrape_response_size_bytes{job="xx"} 49 123
 		scrape_duration_seconds{job="xx"} 0 123
 		scrape_samples_post_metric_relabeling{job="xx"} 2 123
 		scrape_series_added{job="xx"} 2 123
@@ -352,6 +361,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		foo{bar="baz",job="xx",instance="foo.com"} 34.44 123
 		up{job="xx",instance="foo.com"} 1 123
 		scrape_samples_scraped{job="xx",instance="foo.com"} 4 123
+		scrape_response_size_bytes{job="xx",instance="foo.com"} 106 123
 		scrape_duration_seconds{job="xx",instance="foo.com"} 0 123
 		scrape_samples_post_metric_relabeling{job="xx",instance="foo.com"} 1 123
 		scrape_series_added{job="xx",instance="foo.com"} 4 123
@@ -371,6 +381,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		exported_scrape_series_added 3.435 123
 		up 1 123
 		scrape_duration_seconds 0 123
+		scrape_response_size_bytes 76 123
 		scrape_samples_scraped 3 123
 		scrape_samples_post_metric_relabeling 3 123
 		scrape_timeout_seconds 42 123
@@ -389,6 +400,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		scrape_series_added 3.435 123
 		up 1 123
 		scrape_samples_scraped 3 123
+		scrape_response_size_bytes 76 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 3 123
 		scrape_series_added 3 123
@@ -406,6 +418,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		bar{a="b",c="d"} -3e4 123
 		up 1 123
 		scrape_samples_limit 2 123
+		scrape_response_size_bytes 49 123
 		scrape_samples_scraped 2 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 2 123
@@ -424,6 +437,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 	}, `
 		up 0 123
 		scrape_samples_scraped 2 123
+		scrape_response_size_bytes 0 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 2 123
 		scrape_samples_limit 1 123
@@ -445,6 +459,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		bar{a="b",c="d"} -3e4 123
 		up 1 123
 		scrape_samples_scraped 2 123
+		scrape_response_size_bytes 49 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 2 123
 		scrape_series_added 2 123
@@ -464,6 +479,7 @@ func TestScrapeWorkScrapeInternalSuccess(t *testing.T) {
 		foo{bar="baz"} 34.44 123
 		up 1 123
 		scrape_samples_scraped 2 123
+		scrape_response_size_bytes 49 123
 		scrape_duration_seconds 0 123
 		scrape_samples_post_metric_relabeling 2 123
 		scrape_series_added 2 123