prometheus/cmd/promtool
Bryan Boreham 7b03796d0f
Scraping: stop storing discovered labels (#15261)
Instead of storing discovered labels on every target, recompute them if
required. The `Target` struct now needs to hold some more data required
to recompute them, such as ScrapeConfig.

This moves the load from every Prometheus all of the time, to just when
someone views Service Discovery in the UI.

The way `PopulateLabels` is used changes; you are no longer expected to
call it with a part-populated `labels.Builder`.

The signature of `Target.Labels` changes to take a `labels.Builder`
instead of a `ScratchBuilder`, for consistency with `DiscoveredLabels`.

This will save a lot of work when many targets are filtered out in
relabeling. Combine with `keep_dropped_targets` to avoid ever computing
most labels for dropped targets.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-12-21 13:33:08 +00:00
..
testdata Disallowing configure AM with the v1 api (#13883) 2024-10-18 15:23:14 +02:00
analyze.go enable errorf rule from perfsprint linter 2024-11-06 16:50:36 +01:00
analyze_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
archive.go Use github.com/klauspost/compress for gzip and zlib 2024-02-22 17:08:15 +00:00
backfill.go enable errorf rule from perfsprint linter 2024-11-06 16:50:36 +01:00
backfill_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
debug.go refactor (package cmd): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10733) 2022-05-24 16:58:59 +10:00
main.go enable errorf rule from perfsprint linter 2024-11-06 16:50:36 +01:00
main_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
metrics.go lint: Revamp our linting rules, mostly around doc comments 2024-08-22 17:36:11 +02:00
query.go Add analyze histograms command to promtool (#12331) 2024-01-10 17:32:36 +01:00
rules.go chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
rules_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
sd.go Scraping: stop storing discovered labels (#15261) 2024-12-21 13:33:08 +00:00
sd_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
tsdb.go fix promtool analyze block shows metric name with 0 cardinality (#15438) 2024-11-24 17:30:20 +01:00
tsdb_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30
unittest.go feat(tools): add debug printouts to rules unit testing (#15196) 2024-10-22 15:24:36 +02:00
unittest_test.go Parallelize tests in cmd/promtool/ 2024-11-08 21:54:08 +05:30