* RemoveTmpDirs function to tsdbutil
* Refactor db to use RemoveTmpDirs and no longer cleanup checkpoint tmp dirs
* Use RemoveTmpDirs in wlog checkpoint to cleanup all checkpoint tmp folders
* Add tests for RemoveTmpDirs
* Ensure db.Open will still cleanup extra temporary checkpoints
Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
Both are regressions from the parser refactoring in #17977.
- Fixes#18092
- Fixes#18093
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
He's been participating in the bug scrub for a year and provides
reviews all over the code base. Also fix name spelling.
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Convert all timing-sensitive subtests of TestAsyncRuleEvaluation to use
synctest for deterministic testing. This fixes flakiness on Windows
caused by timer granularity and scheduling variance.
The timing assertions are preserved using synctest's fake time, which
allows accurate verification of sequential vs concurrent execution
timing without relying on wall-clock time.
Fixes#17961
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Replace polling loops (for range 100 { time.Sleep }) with explicit
db.Compact() calls after disabling background compaction, eliminating
CI flakiness on slow machines. Also fix incorrect overlap assertions
that were checking the wrong direction (LessOrEqual -> GreaterOrEqual).
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
In addHistogramDataPoints, exemplars assigned to the +Inf bucket of one
data point were carried over into the _sum and _count Append calls of
the next data point via the shared appOpts. Clear appOpts.Exemplars at
the start of each loop iteration to restore the nil-exemplar semantics
that existed before the AppenderV2 migration.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
The OTLP write handler and the PRW v2 histogram append path were missing
ErrTooOldSample from their error type checks, causing these errors to
fall through to the default case and return HTTP 500 Internal Server Error.
This triggered unnecessary retries in OTLP clients like the Python SDK.
The PRW v1 write handler (line 115) and the PRW v2 sample append path
(line 377) already correctly handle ErrTooOldSample as a 400, and this
change makes the remaining paths consistent.
Also adds ErrTooOldSample to the v1 sample/histogram log checks so
these errors are properly logged instead of silently returned.
Fixes#16645
Signed-off-by: Varun Chawla <varun_6april@hotmail.com>
* Add new test cases for multiple name matchers in PromQL info function
* Fix handling of multiple name matchers in PromQL info function
---------
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
With native histograms being a stable feature, we should get rid of
this special line, which isn't really mapping maintainership to a
subtree, but to something that is all over the codebase.
Additionally, @beorn7 will soon retire from the project, so we needed
to remove him from this file anyway.
Signed-off-by: beorn7 <beorn@grafana.com>
Parser configuration is now per-engine/API/loader and no longer uses package-level flags, so behavior is consistent and tests don't rely on save/restore of global variables.
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
avg_over_time would produce +Inf count/sum and NaN zero bucket when
averaging a single histogram, because the count variable was initialized
to 0 instead of 1. This caused a division by zero at the end of the
function.
The float version of avg_over_time already correctly initializes count
to 1, this change makes the histogram version consistent with that.
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Add regression test for the bug where avg_over_time with a single
histogram sample would produce +Inf count/sum and NaN zero bucket
due to division by zero. The test verifies that both regular
exponential histograms and native histograms with custom buckets
(NHCB) correctly return the histogram unchanged when averaging
a single sample.
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>