mirror of
https://github.com/prometheus/prometheus
synced 2026-04-20 22:41:05 +08:00
promqltest: use AppenderV2 in load command (#18359)
Some checks failed
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Compliance testing (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
Some checks failed
buf.build / lint and publish (push) Has been cancelled
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Compliance testing (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Sync repo files / repo_sync (push) Has been cancelled
* promqltest: use AppenderV2 in load command Switch the PromQL test framework's load command from storage.Appender to storage.AppenderV2 in appendSample, appendCustomHistogram and appendTill. ST is set to 0 (unknown) for now; a follow-up will add per-sample ST specification in load statements. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> Coded with Claude Sonnet 4.6. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> * promqltest: fix unchecked Rollback error Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> Coded with Claude Sonnet 4.6. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com> --------- Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
committed by
GitHub
parent
cfcc862182
commit
1ec24a3295
@@ -686,7 +686,7 @@ func (cmd *loadCmd) set(m labels.Labels, vals ...parser.SequenceValue) {
|
||||
}
|
||||
|
||||
// append the defined time series to the storage.
|
||||
func (cmd *loadCmd) append(a storage.Appender) error {
|
||||
func (cmd *loadCmd) append(a storage.AppenderV2) error {
|
||||
for h, smpls := range cmd.defs {
|
||||
m := cmd.metrics[h]
|
||||
|
||||
@@ -737,7 +737,7 @@ func processClassicHistogramSeries(m labels.Labels, name string, histogramMap ma
|
||||
|
||||
// If classic histograms are defined, convert them into native histograms with custom
|
||||
// bounds and append the defined time series to the storage.
|
||||
func (cmd *loadCmd) appendCustomHistogram(a storage.Appender) error {
|
||||
func (cmd *loadCmd) appendCustomHistogram(a storage.AppenderV2) error {
|
||||
histogramMap := map[uint64]tempHistogramWrapper{}
|
||||
|
||||
// Go through all the time series to collate classic histogram data
|
||||
@@ -800,17 +800,13 @@ func (cmd *loadCmd) appendCustomHistogram(a storage.Appender) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func appendSample(a storage.Appender, s promql.Sample, m labels.Labels) error {
|
||||
func appendSample(a storage.AppenderV2, s promql.Sample, m labels.Labels) error {
|
||||
if s.H != nil {
|
||||
if _, err := a.AppendHistogram(0, m, s.T, nil, s.H); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err := a.Append(0, m, s.T, s.F); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := a.Append(0, m, 0, s.T, 0, nil, s.H, storage.AppendV2Options{})
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
_, err := a.Append(0, m, 0, s.T, s.F, nil, nil, storage.AppendV2Options{})
|
||||
return err
|
||||
}
|
||||
|
||||
// evalCmd is a command that evaluates an expression for the given time (range)
|
||||
@@ -1448,9 +1444,9 @@ func (t *test) exec(tc testCommand, engine promql.QueryEngine) error {
|
||||
t.clear()
|
||||
|
||||
case *loadCmd:
|
||||
app := t.storage.Appender(t.context)
|
||||
app := t.storage.AppenderV2(t.context)
|
||||
if err := cmd.append(app); err != nil {
|
||||
app.Rollback()
|
||||
_ = app.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1772,7 +1768,7 @@ func (ll *LazyLoader) clear() error {
|
||||
|
||||
// appendTill appends the defined time series to the storage till the given timestamp (in milliseconds).
|
||||
func (ll *LazyLoader) appendTill(ts int64) error {
|
||||
app := ll.storage.Appender(ll.Context())
|
||||
app := ll.storage.AppenderV2(ll.Context())
|
||||
for h, smpls := range ll.loadCmd.defs {
|
||||
m := ll.loadCmd.metrics[h]
|
||||
for i, s := range smpls {
|
||||
|
||||
Reference in New Issue
Block a user