Commit graph

379 commits

Author SHA1 Message Date
Julien
c6d2fa3596
Merge pull request #18519 from alliasgher/fix-testfstype-unknown-fs
util/runtime: let TestFsType tolerate filesystems absent from FsType map
2026-04-15 14:12:13 +02:00
alliasgher
ae063a499a util/runtime: simplify TestFsType comment per review
Remove issue reference and trim the comment down to the assertion's
intent, per @roidelapluie review.

Signed-off-by: alliasgher <alliasgher123@gmail.com>
2026-04-15 15:54:02 +05:00
Toni Cárdenas
2ad75b0ef0
util/strutil: remove duplicate isASCII declaration (#18522)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests for Prometheus upgrades and downgrades (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Signed-off-by: Toni Cárdenas <toni.cardenasvargas@grafana.com>
2026-04-14 16:46:11 +00:00
alliasgher
6994b4cb4e util/runtime: simplify TestFsType to check != 0 instead of _MAGIC
Signed-off-by: alliasgher <alliasgher123@gmail.com>
2026-04-14 20:26:13 +05:00
Julien
1c449737e1
util/strutil: add Jaro-Winkler similarity implementation (#18405)
* util/strutil: add Jaro-Winkler similarity implementation

This is part of the implementation of prometheus/proposals#74

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

* util/strutil: optimise JaroWinkler with string-native ASCII path

Replace the generic jaroWinkler[T byte|rune] with two specialised
functions: jaroWinklerString (ASCII path) operates directly on the
string values and avoids the []byte conversion that previously caused
two heap allocations per call; jaroWinklerRunes (Unicode path) is
unchanged in algorithm but split out from the generic.

Both paths replace the repeated float64 divisions in the Jaro formula
with precomputed reciprocals (invL1, invL2).

Result: short ASCII strings drop from 2 allocs/op to 0 allocs/op;
long ASCII drops from 4 allocs/op to 2 allocs/op (bool match arrays
only).

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

* util/strutil: replace JaroWinkler with JaroWinklerMatcher

Remove the free JaroWinkler function and replace it with a
JaroWinklerMatcher struct. NewJaroWinklerMatcher pre-computes the
ASCII check and rune conversion for the search term once; Score then
runs the comparison against each candidate without repeating that work.

This is the expected usage pattern in Prometheus: one fixed term scored
against many label names or values.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

* Update util/strutil/jarowinkler.go and util/strutil/jarowinkler_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Julien <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>

---------

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Signed-off-by: Julien <291750+roidelapluie@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2026-04-14 16:58:46 +02:00
Julien
0b067888c7
Merge pull request #18402 from roidelapluie/roidelapluie/strutil_subsequence
util/strutil: add subsequence matching implementation
2026-04-14 16:55:56 +02:00
Ali
48f4a41e38 util/runtime: skip TestFsType on unknown filesystems instead of accepting hex format
Rather than widening the assertion to accept raw hex codes, skip the
strict _MAGIC format check with t.Skipf when the filesystem is not in
the known map. The test still exercises the error paths and will run
fully on standard Linux/macOS filesystems.

Fixes prometheus/prometheus#18471

Signed-off-by: Ali <ali@kscope.ai>
2026-04-14 16:49:46 +05:00
Ali
366ee531bb util/runtime: let TestFsType tolerate filesystems absent from FsType map
FsType() returns the known magic-name string when the filesystem is
present in its internal map, and falls back to strconv.FormatInt(..., 16)
otherwise. The test was asserting the *MAGIC regex only, so it failed
whenever it happened to run on a filesystem not yet mapped — the
downstream Arch Linux packager hit this with a btrfs subvolume.

Extend the regex to accept either a magic-name or the numeric
lowercase-hex fallback, keeping the test stable across OS upgrades and
exotic filesystems.

Fixes #18471

Signed-off-by: Ali <alliasgher123@gmail.com>
2026-04-14 01:21:26 +05:00
Laurent Dufresne
e100520467 annotations: add warning for ineffective sort in range queries
Co-authored-by: Bojun Kim <bojun.kim@deliveryhero.com>
Co-authored-by: Laurent Dufresne <laurent.dufresne@grafana.com>
Signed-off-by: Laurent Dufresne <laurent.dufresne@grafana.com>
2026-04-09 15:21:11 +02:00
Julien
e4d966771a
Merge pull request #18475 from roidelapluie/roidelapluie/fuzzing-dict-fuzzparseexpr
fuzzing: generate libFuzzer dictionary for FuzzParseExpr
2026-04-09 09:54:12 +02:00
Julien Pivotto
efe305b898 fuzzing: generate libFuzzer dictionary for FuzzParseExpr
Export parser.Keywords() and add GetDictForFuzzParseExpr() so that
the corpus generator can produce a stable fuzzParseExpr.dict file
derived directly from the PromQL grammar rather than maintained by hand.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-08 17:38:23 +02:00
Justin Kromlinger
0d9776a3a4
Update FsType magic list
Taken from `/usr/include/linux/magic.h` with linux-api-headers v6.19.

Includes newer popular filesystems like btrfs.

Also see #18471.

Signed-off-by: Justin Kromlinger <hashworks@archlinux.org>
2026-04-08 11:02:49 +02:00
Ayoub Mrini
0dd834e924
Merge pull request #18406 from machine424/depll
test: migrate TestDelayedCompaction to synctest to eliminate flakiness
2026-04-01 16:40:50 +02:00
Julien Pivotto
81403bc785 util/fuzzing: fix changed field name CreatedTimestamp in protobuf corpus
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-01 15:08:33 +02:00
Julien Pivotto
aba887e21e fuzzing: add FuzzParseProtobuf fuzz target and corpus generation
Add a new FuzzParseProtobuf fuzz target that exercises the protobuf
exposition-format parser

Reduce per-target fuzz time to 4m to keep budget acceptable with
the additional target.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-03-31 17:25:26 +02:00
Julien
7fd7a393b6
convertnhcb: reject NaN bucket boundary in SetBucketCount (#18383)
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-03-31 14:23:17 +02:00
machine424
dcfb8ce59c
chore: remove util/testutil/synctest now that we use Go>=1.25
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2026-03-30 19:48:39 +02:00
Julien Pivotto
d23e69322e chunkenc: Add XOR/XOR2 fuzzing
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-03-25 17:05:47 +01:00
George Krajcsovits
9670de1c35
Revert "annotations: add warning for ineffective sort in range queries (#16628)" (#18357)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
This reverts commit 3f80815e1b.
2026-03-24 16:33:38 +01:00
Bojun Kim
3f80815e1b
annotations: add warning for ineffective sort in range queries (#16628)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
* feat(annotations): add warning for ineffective sort in range queries

Signed-off-by: poi1649 <bojun.kim@deliveryhero.com>

* feat(annotations): add Warning for sort_by_label and sort_by_label_desc as well

Signed-off-by: poi1649 <bojun.kim@deliveryhero.com>

* fix formatting

Signed-off-by: poi1649 <bojun.kim@deliveryhero.com>

* Apply suggestion from @poi1649

Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>

* Apply suggestion from @poi1649

Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>

* Update annotations.go

Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>

* Update annotations.go

Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>

* Update annotations.go

Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>

* adjust formatting

Signed-off-by: poi1649 <bojun.kim@deliveryhero.com>

---------

Signed-off-by: poi1649 <bojun.kim@deliveryhero.com>
Signed-off-by: Bojun Kim <bojun.kim@deliveryhero.com>
2026-03-24 13:00:36 +01:00
Domantas
2129702dff
perf(PromQL): allow inlining kahansum.Inc (#18319)
Signed-off-by: Domantas Jadenkus <djadenkus@gmail.com>
Signed-off-by: Domantas <djadenkus@gmail.com>
Co-authored-by: Linas Medžiūnas <linasm@users.noreply.github.com>
2026-03-19 15:31:20 +01:00
bwplotka
3cf43337dc post merge conflict fixes
Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-03-12 09:03:08 +00:00
bwplotka
c133a969af Merge branch 'main' into start-time-main-sync 2026-03-12 08:28:15 +00:00
machine424
bb272d7201
chore(kubernetes): deduplicate warning logs from the API
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2026-03-12 08:34:33 +01:00
Bartlomiej Plotka
9dc782bf2c
Merge pull request #18220 from prometheus/extended-test
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
tests(tsdb/wlog): Tighten watcher tail tests
2026-03-05 11:31:04 +01:00
Bartlomiej Plotka
d448f3f970
Merge pull request #18218 from prometheus/utilrecord
tests(util/testwal): Move WAL record generation to separate package for reuse
2026-03-05 10:07:57 +01:00
Matthieu MOREL
45b9329e68
chore: fix emptyStringTest issues from gocritic (#18226)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2026-03-04 08:24:50 +01:00
bwplotka
3678ff9042 tests(tsdb/wlog): Tighten watcher tail tests
Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-03-03 13:06:16 +00:00
George Krajcsovits
feb741e470
Merge pull request #18215 from mmorel-35/gocritic
chore: fix httpNoBody issues from gocritic
2026-03-03 12:50:19 +01:00
bwplotka
596830ee72 tests(util/testwal): Move WAL record generation to separate package for reuse
Signed-off-by: bwplotka <bwplotka@gmail.com>

tmp

Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-03-03 10:06:21 +00:00
Owen Williams
c4deef472e
Merge remote-tracking branch 'origin/main' into feature/start-time
Signed-off-by: Owen Williams <owen.williams@grafana.com>
2026-03-02 14:47:44 -05:00
Matthieu MOREL
026d284c43 chore: fix httpNoBody issues from gocritic
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2026-03-02 20:06:30 +01:00
Julien Pivotto
8b4318ad34 util/runtime: cast Blocks to uint64 to fix type mismatch on different architectures
On some GOOS (e.g. dragonfly), statfs.Blocks is int64, which can
cause a type mismatch when multiplied with Bsize. Cast both operands to
uint64 explicitly.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-27 15:49:17 +01:00
Ganesh Vernekar
ccc3062521 Merge branch 'main' into codesome/merge-3.10
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2026-02-25 17:33:06 -08:00
bwplotka
8f3a6020d8 Merge branch 'main' into st-main-sync2 2026-02-25 13:54:25 +00:00
Julien
9d38077e50
Merge pull request #18080 from ldufr/ldufresne/retention-size-percentage
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Add percentage based retention
2026-02-24 15:50:36 +01:00
Jérôme LOYET
696679e50c Add storage.tsdb.retention.percentage config
Signed-off-by: Jérôme LOYET <822436+fatpat@users.noreply.github.com>
Signed-off-by: Laurent Dufresne <laurent.dufresne@grafana.com>
2026-02-24 15:27:45 +01:00
bwplotka
56c46af6a6 Merge branch 'main' into st-f-main 2026-02-23 10:00:39 +00:00
Matthieu MOREL
addc3dcb47 chore: enable staticcheck linter and update golangci-lint to 2.10.1
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2026-02-18 15:58:16 +00:00
Julien Pivotto
7d0a39ac93 chore(lint): enable wg.Go
Since our minimum supported go version is now go 1.25, we can use wg.Go.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-02-17 15:21:51 +01:00
Owen Williams
d19a9c2dc7
Merge remote-tracking branch 'origin/main' into feature/start-time 2026-02-12 13:18:12 -05:00
Owen Williams
b57f5b59b3
tsdb: ST-in-WAL: Counter implementation and benchmarks (#17671)
Initial implementation of https://github.com/prometheus/prometheus/issues/17790.
Only implements ST-per-sample for Counters. Tests and benchmarks updated.

Note: This increases the size of the RefSample object for all users, whether st-per-sample is turned on or not.

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2026-02-12 13:17:50 -05:00
Ganesh Vernekar
0d59a920bc Remove the goexperiment.synctest build tag
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
2026-02-11 13:53:10 -08:00
Martin Valiente Ainz
eb5a0e1eed
Refactor parse.go into an instance-based Parser interface
Signed-off-by: Martin Valiente Ainz <64830185+tinitiuset@users.noreply.github.com>
2026-02-11 11:21:49 +01:00
Martin Valiente Ainz
af16f35ad6
PromQL: Refactor parser to use instance configuration instead of global flags
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>
2026-02-11 11:16:04 +01:00
Sasha
1dcdb07d30
promql: use Kahan summation for Native Histograms (#15687)
As for float samples, Kahan summation is used for the `sum` and `avg` aggregation and for the respective `_over_time` functions.

Kahan summation is not perfect. This commit also adds tests that even Kahan summation cannot reliably pass.
These tests are commented out.

Note that the behavior might be different on other hardware platforms. We have to keep an eye on test failing on other hardware platforms and adjust them accordingly.

Signed-off-by: Aleksandr Smirnov <5targazer@mail.ru>
2026-02-08 00:52:22 +01:00
zenador
4321a5573c
Use custom annotation for histogram quantile monotonicity info to provide more details (#15578)
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2026-02-05 18:35:48 +01:00
zenador
c0ad853750
promql: Make it possible to add custom details in annotations and summarise multiple of the same annotation (#15577)
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: zenador <zenador@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2026-02-03 15:12:02 +01:00
Bartlomiej Plotka
848b16d686
test: Add benchmark without storage + fix skipRecording mock feature (#17987)
* test: Add benchmark without storage

Signed-off-by: bwplotka <bwplotka@gmail.com>

make bench fair

Signed-off-by: bwplotka <bwplotka@gmail.com>

tmp

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Apply suggestions from code review

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2026-02-02 12:44:11 +00:00
Bartlomiej Plotka
9657c23c37
storage: optimized fanoutAppenderV2 (#17976)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
* storage: add BenchmarkFanoutAppenderV2

Signed-off-by: bwplotka <bwplotka@gmail.com>

* fix: optimized fanoutAppenderV2

Signed-off-by: bwplotka <bwplotka@gmail.com>

* optimized more

Signed-off-by: bwplotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
2026-02-02 07:04:30 +00:00