VictoriaMetrics/lib/promscrape
Aliaksandr Valialkin ac5528cb46
lib/promscrape: properly add exported_ prefix to labels, which clash with target labels if honor_labels: true option isn't set.
The issue was in the `labels := dst[offset:]` line in the beginning of appendExtraLabels() function.
The `dst` may be re-allocated when adding extra labels to it. In this case the addition of `exported_`
prefix to labels inside `labels` slice become invisible in the returned `dst` labels.

While at it, properly handle some corner cases:

- Add additional `exported_` prefix to clashing metric labels with already existing `exported_` prefix.
- Store scraped metric names in `exported___name__` label if scrape target contains `__name__` label.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3278

Thanks to @jplanckeel for the initial attempt to fix this issue
at https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3281
2022-10-28 22:15:31 +03:00
..
discovery lib/promscrape/discovery/kubernetes: do not print an empty kubeconfig_file option in yaml at /config page 2022-10-28 22:15:30 +03:00
discoveryutils lib/bytesutil: move InternString() from lib/promscrape/discoverytutils to lib/bytesutil 2022-09-30 07:34:59 +03:00
testdata lib/promscrape: fix errors in test config 2022-02-08 20:10:28 +02:00
client.go all: subsitute ioutil.ReadAll with io.ReadAll 2022-08-22 00:16:04 +03:00
config.go lib/envtemplate: allow referring env vars from other env vars via %{ENV_VAR} syntax 2022-10-26 14:51:02 +03:00
config_test.go lib/promscrape: allow controlling staleness tracking on a per-scrape_config basis 2022-10-07 23:37:31 +03:00
scraper.go lib/promscrape: update links to sd_configs from Prometheus site to https://docs.victoriametrics.com/sd_configs.html 2022-08-15 01:40:48 +03:00
scrapework.go lib/promscrape: properly add exported_ prefix to labels, which clash with target labels if honor_labels: true option isn't set. 2022-10-28 22:15:31 +03:00
scrapework_test.go lib/promscrape: properly add exported_ prefix to labels, which clash with target labels if honor_labels: true option isn't set. 2022-10-28 22:15:31 +03:00
scrapework_timing_test.go lib/promscrape: follow-up after 2c553d5a2f 2022-08-08 14:49:16 +03:00
statconn.go lib/promscrape: properly show proxy_url option value at /config page 2021-10-26 21:24:22 +03:00
targetstatus.go lib/promscrape: allow specifying full target url in __address__ label 2022-10-07 22:46:29 +03:00
targetstatus.qtpl all: follow-up after 8edb390e21 2022-06-07 01:05:53 +03:00
targetstatus.qtpl.go all: follow-up after 8edb390e21 2022-06-07 01:05:53 +03:00