VictoriaMetrics/lib/promscrape
Aliaksandr Valialkin 76e8888272
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:14:26 +03:00
..
discovery lib/promscrape/discovery/kubernetes: do not print an empty kubeconfig_file option in yaml at /config page 2022-10-28 22:14:25 +03:00
discoveryutils lib/bytesutil: move InternString() from lib/promscrape/discoverytutils to lib/bytesutil 2022-09-30 07:44:35 +03:00
testdata lib/promscrape: fix errors in test config 2022-02-08 19:56:37 +02:00
client.go all: subsitute ioutil.ReadAll with io.ReadAll 2022-08-22 00:16:37 +03:00
config.go lib/envtemplate: allow referring env vars from other env vars via %{ENV_VAR} syntax 2022-10-26 14:49:33 +03:00
config_test.go lib/promscrape: allow controlling staleness tracking on a per-scrape_config basis 2022-10-07 23:36:14 +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:20 +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:14:26 +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:14:26 +03:00
scrapework_timing_test.go lib/promscrape: follow-up after 2c553d5a2f 2022-08-08 14:46:26 +03:00
statconn.go lib/promscrape: properly show proxy_url option value at /config page 2021-10-26 21:23:54 +03:00
targetstatus.go lib/promscrape: allow specifying full target url in __address__ label 2022-10-07 22:43:04 +03:00
targetstatus.qtpl Revert "lib/promscrape, vmagent: fix path to files (#2801)" 2022-06-30 18:23:56 +03:00
targetstatus.qtpl.go Revert "lib/promscrape, vmagent: fix path to files (#2801)" 2022-06-30 18:23:56 +03:00