Repository navigation
test(prom): PromQL parity harness against Prometheus (M3, #922) - #1069
Guess-Who-sec wants to merge 4 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@rita7lopes one small thing for your review: |
|
@rita7lopes before you review: your reason for dropping |
rita7lopes
left a comment
There was a problem hiding this comment.
Thanks, this is the right approach. A few things before I merge:
- Please don't hardcode versions, I don't want to update them by hand. Move the test into the root module (no nested
go.mod), and replace the Prometheus download withgo install github.com/prometheus/prometheus/cmd/prometheus@$(go list -m -f '{{.Version}}' github.com/prometheus/prometheus). The reference then always matches gigapipe'sgo.mod, and the checksum table goes away. Please remove version numbers from the README too. - The suite starts querying once the last snapshot is served, and the previous snapshot already satisfies its readiness check, so the first queries can run before the last one is stored. Please start the query proxy only after the first empty scrape.
run.shshould always use its ownhttp://localhost:3100. WithGIGAPIPE_URLset in the shell, it writes test data into that instance.- Please count skipped queries too. The suite skips any query whose error contains "501".
- The suite queries at a 10s step, so gigapipe answers from raw samples and
metrics_15sis never used. Please say so in the README. Before #1112 records a baseline, I'd like a second run at a 60s step. - Please add
parity-promto.PHONYwhen you update from master.
Your questions: 1 and 2, yes. 3, keep dropping it. 4, record as not covered yet. 5, keep it here. 6, please try storage.tsdb.out_of_order_time_window: 2h on the reference: its up sample is stamped now, so anything older than 1 hour is rejected, which matches the 7 snapshots. With that, both sides should have the same data.
Run the PromQL compliance suite with a real Prometheus 3.15.1 as the reference and gigapipe built from this tree as the target. Gigapipe doesn't scrape, so its target scrapes the suite's replayer itself, remote-writes the samples and proxies the queries. `make parity-prom` prints how many queries agree; it is report-only for now. The suite lives in its own module under compatibility/prometheus, so gigapipe's go.mod and binary are unchanged.
- move the parity test into the root module behind the parity build tag - install the reference with go install at go.mod's Prometheus version - start answering queries only after every snapshot is stored - give the reference a 2h out-of-order window so both sides hold the same data - always test run.sh's own gigapipe, count skipped queries - PARITY_STEP rewrites the range query step on both sides - add parity-prom to .PHONY
7961ed3 to
612d48b
Compare
|
Thanks, all done, rebased onto current master (
Your question 6, the out-of-order window: confirmed. With |
The suite scrapes every 15ms and Prometheus caps the scrape timeout at the interval, so a scrape slower than 15ms was abandoned and its snapshot lost on the reference side only. Every query covering it then differed: 2 of 9 local runs reported about 250 false differences. - scrape the replay every 250ms (the suite allows 2 minutes for it) - before serving queries, check the reference holds as many demo_num_cpus samples as were sent to gigapipe, and fail the setup with both counts if it doesn't
|
One more fix, found while recording #1112's baseline: the harness could lose a snapshot on the reference side. The suite scrapes every 15ms, and Prometheus caps the scrape timeout at the interval (the running reference reports Fixed in 669fa5c:
Results unchanged: 3 runs at 10s, 544 / 116, the same queries; 60s, 539 / 121. |
Part of #922 (M3): the PromQL parity harness. Next in #922: baseline ratchet (#1112), triage, release-gate skeleton, k6 fix.
No dependencies: branches from
master.What it does
make parity-promruns the PromQL compliance suite (Apache-2.0) with a real Prometheus as the reference and gigapipe built from this tree as the target, then prints how many queries agree, differ and were skipped. Report-only: differences don't fail it; the ratchet PR makes it a gate.No hardcoded versions. The test is in gigapipe's root module behind the
paritybuild tag (no nestedgo.mod), and the reference Prometheus is installed withgo install github.com/prometheus/prometheus/cmd/prometheus@<version in go.mod>, so it always matches gigapipe'sgo.modand Dependabot updates both.How the data gets in: the suite replays a recorded 70-minute dataset through a scrape endpoint. Gigapipe doesn't scrape, so its target scrapes the replayer itself and sends the samples to
/api/v1/prom/remote/write. It starts answering the suite's queries only after the replayer has served every snapshot (the first empty scrape) and the reference holds the same data.Same data on both sides: the replay is scraped every 250ms instead of the suite's 15ms, because Prometheus's scrape timeout is the interval, and a scrape that misses it loses its snapshot on the reference side only. As a check, the reference must hold as many
demo_num_cpussamples as were sent to gigapipe, or the setup fails with both counts.Files
compatibility/prometheus/parity_test.go(//go:build parity): the two targets andTestPromQLParitycompatibility/prometheus/run.sh: installs Prometheus atgo.mod's version, starts thetest/integrationstack, runs the suite, prints the countscompatibility/prometheus/README.md,.gitignorego.mod/go.sum: addgithub.com/prometheus/compliance; no existing dependency changes versionMakefile:parity-promtarget, in.PHONYResult today (master
a2c307c9)660 queries at the suite's 10s step: 544 agree, 116 differ, 0 skipped, identical query by query across 7 runs (a run now takes ~2.5 min including the gigapipe build; the first
go installof Prometheus takes another ~5 min).offset -1m,-5m,-10m): gigapipe returns[PQRC001] negative offset is disabled.The 15
[1h]differences from the first version are gone: the reference now has a 2-hour out-of-order window. Without it, the same run gives 529 / 131 with those 15 back.At a 60s step (
PARITY_STEP=60s make parity-prom), wheremetrics_15scan be used: 539 agree, 121 differ, 0 skipped, identical across 2 runs. The same 116 plus 5 that differ only at 60s:last_over_time(demo_memory_usage_bytes[1m|5m|15m|1h]): same values, but gigapipe drops the metric name, which Prometheus keeps.predict_linear(demo_disk_usage_bytes[1m], 600): Prometheus returns 3 series, gigapipe none.service_nameis still dropped from the comparison, as agreed;PARITY_KEEP_SERVICE_NAME=1keeps it.Verification
What was run:
the reference holds 519 demo_num_cpus samples, gigapipe was sent 522; before the fix, the same delay gave 294 agree / 366 differ[1h]differences returndemo_num_cpusqueries gave 26 skipped (the other 4demo_num_cpusqueries are ones the suite expects to fail, so any error counts as agreeing and the 501 check isn't reached)go installatgo.mod's version (v0.316.0) builds and runsgo mod tidyno-op; the gigapipe binary's package list (go list -deps ./cmd/gigapipe, 693 packages) identical to master'sgo test ./...passes (doesn't build the parity tag);go vet ./...same findings as master;go vet -tags parityclean;make lintandgolangci-lint --build-tags parity0 issues; staticcheck with the tag clean;gofmtclean; shellcheck onrun.shcleanPotential risks
make parity-prom; the release-gate PR adds it to CI.go installbuilds Prometheus from source (~5 min, ~140 MB binary inbin/<version>/, gitignored).prometheus --versionshows no version number, sincego installdoesn't set it.test/integration/run.sh.go.mod, so a bump can change the counts; the ratchet PR's baseline will show that.parity_test.gois a standard Prometheus scrape config written for this test.