Repository navigation
test(prof): pin the profiles series discovery response (M5, #919) - #1114
Open
Guess-Who-sec wants to merge 8 commits into
Open
Guess-Who-sec wants to merge 8 commits into
Guess-Who-sec wants to merge 8 commits into
Conversation
This was referenced Nov 20, 2026
metrico#920) The integration workflow built, started and tested gigapipe with raw commands. It now runs make build, make integration-start and make test-integration, and test/integration/run.sh runs the same make test-integration, so CI and local runs are the same commands. integration-start waits up to 60s for /api/v1/status/buildinfo and prints gigapipe.log if gigapipe never answers.
run.sh changed to the repository root before running the tests, but the EXIT trap runs `docker compose -f docker-compose.yml` with a relative path, so teardown failed (hidden by `|| true`) and left the gigapipe and ClickHouse containers running after every run. Run the tests in a subshell so the trap still runs from test/integration.
…/4, metrico#920) Add test/integration/seed, a deterministic declaration of the data the integration tests write: services and pods, from which every signal is derived. Logs are generated with a fixed random seed, so the same fixture always produces the same push body; Run only sets the m2_run label that keeps one run's data apart from earlier runs. TestLogsRoundTrip pushes the fixture through /loki/api/v1/push and checks what the Loki read APIs return against it, one named case each: every line per stream, a line filter, the json parser with a label filter, count_over_time per pod, labels, label values and series. The query_range, instant query, label values and series responses are also compared with pinned copies under testdata/logs/, since that JSON is what Grafana reads. Run-specific values (the run label, timestamps) are normalized before the comparison. The pins are maintained by hand; there is no regeneration mode. gigapipe's labels endpoint ignores the query parameter Loki uses to narrow it to a selector, so that case cannot be limited to one run; the series case covers the label sets.
…ctly (M2 2/4, metrico#920) Review of metrico#1061: the label values come from SELECT DISTINCT without ORDER BY, so they are sorted before comparing. The pinned responses are decoded strictly: an undeclared field or data after the response fails, and log entries and vector samples must have exactly two elements. gigapipe.log and gigapipe.pid, created by make integration-start, are ignored.
…(M2 3/4, metrico#920) Extend the seed with the other three signals, all derived from the same declaration of services and pods: - metrics: per pod, an http_requests_total counter growing by RequestsPerScrape at every 15s scrape and a process_resident_memory_bytes gauge, sent as a Prometheus remote-write request (snappy protobuf) - traces: per checkout pod, a POST /checkout -> charge -> INSERT payments trace across both services, sent as OTLP/HTTP protobuf; trace IDs are derived from the run, so runs never share one - profiles: per pod, three consecutive 10s CPU profiles uploaded to /ingest the way the Pyroscope Go SDK uploads them (multipart pprof, name "<app>{labels}") TestMetricsRoundTrip, TestTracesRoundTrip and TestProfilesRoundTrip read them back the way their clients do: the Prometheus query API; the Tempo API as Grafana's Tempo data source uses it (trace by ID as protobuf, TraceQL search, tag names and values); the Pyroscope Connect API as Grafana's Pyroscope data source uses it, plus /pyroscope/render and /pyroscope/render-diff. Every value is checked against the fixture, one named case each. Pinned responses under testdata/{metrics,traces,profiles} follow the same rules as the logs pins: run-specific values normalized, maintained by hand. The rate query is checked with a 1e-9 tolerance and not pinned, since its last digits depend on the order the per-pod rates are added. If data does not show up within 30s, the tests log it and still run every named case, so a broken ingest path reports which answers are wrong.
…y (M2 3/4, metrico#920) Review of metrico#1062: the flame graph pins (SelectMergeStacktraces, render, render-diff) hold call stacks with their total and self values instead of the raw names and levels arrays, whose order the query doesn't define. The matrix, search and render responses are decoded strictly, and matrix points must have exactly two elements.
metrico#920) Several pinned values of the render responses are zero, empty or null (leftTicks, rightTicks, spyName, timeline), so a missing key would decode to the same value: every declared field is now required.
The Connect Series call returns one label set per pod and sample type. The new check asserts the 8 series the seed fixture uploads (4 pods x samples/count and cpu/nanoseconds) and that no label repeats within a series, then compares the response with testdata/profiles/series.json, written by hand. The run label becomes "RUN" and the series are sorted; label order within a series is not compared. With the render and render-diff goldens already pinned in M2, this is the third response shape metrico#919 asks for: merge, diff, series/labels discovery.
Guess-Who-sec
force-pushed
the
test/m5-prof-series-golden
branch
from
November 25, 2026 15:01
d962669 to
546a38b
Compare
Contributor
Author
|
Rebased onto the updated #1062 and current |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #919 (M5): the series/labels discovery golden.
Depends on #1062 (M2 3/4), which depends on #1061: this branch is built on them, so its first 7 commits are theirs (#1061: 4, #1062: 3). Merge those first; I'll rebase this one onto
masterthen. Only the last commit is new here.Why this is the only golden left for M5
Your re-scope of #919 keeps hand-written response goldens for one merge, one diff and one series/labels discovery. M2 already pins the first two:
profiles/render_cpu.json(/pyroscope/render) andprofiles/flamegraph_cpu.json(ConnectSelectMergeStacktraces), in #1062profiles/render_diff_cpu.json(/pyroscope/render-diff), in #1062profiles/series.json(ConnectSeries)#1062 checks label names and values but pins no discovery response, and doesn't call
Seriesat all.What it does
A
seriescheck intest/integration/profiles_roundtrip_test.gocalls/querier.v1.QuerierService/Serieswith the run's matcher, as the other profile checks do:samples/countandcpu/nanoseconds, so 8 series. No label may appear twice in a series.testdata/profiles/series.json. The run label value becomesRUNand series are sorted (the same normalisation as the other goldens); label order within a series isn't compared.series.jsonis written by hand, with no regeneration command. I checked each of the 8 entries against the fixture: the profile-type labels match thecpuNanosType/cpuSamplesTypeconstants the other checks use, andservice_name,podandm2_runare exactly what the upload sends.labelNamesisn't sent, so every label comes back. A request withlabelNames(only those labels kept,FilterLabelsPlanner) is another shape and isn't covered here.Question
#919's determinism audit item (no ambient time or rand in the prof transpiler's decisions and responses) isn't in your keep or drop lists. Keep it as a separate task, or drop it? The goldens above pass identically across runs, which covers the responses they pin but isn't the audit #919 describes.
Verification
After rebasing onto the updated #1062 and current
master(ClickHouse 26.10): the whole integration suite passes on a fresh stack viatest/integration/run.sh(19 tests, including theseriescase), andgofmt,go vet(no new findings), the build,go test ./..., golangci-lint and staticcheck are clean. The rebase needed no change to this PR.Earlier results, before the rebase:
test/integration/run.sh: 3 runs, 52 passed, 0 failed each__period_unit__label from the Series response inreader/service/prof.gofails onlyseries, with "response differs from testdata/profiles/series.json (edit the file by hand if the change is intended)"; its behaviour checks and every other check still pass. Reverted.podtwice in every Series label set fails onlyseries, withlabel "pod" appears twice in series ...for all 8 series. Reverted.make build,make integration-start,make test-integration): 52 passed, 0 failedgolangci-lintwith--build-tags integration(the default lint run skips these files): 0 issues;go vet -tags integration ./test/integration/andgofmtclean; rootgo build ./...andgo test ./...pass (37 packages)Potential risks
series.jsonis edited by hand, which is the point of a golden.