Commit graph

389 commits

Author SHA1 Message Date
Minh Vu
19d60b983e
documentcli: fix repeated flag markup (#18829)
Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
2026-06-01 11:04:29 +02:00
Julien Pivotto
7a70afb5a4 fuzzing: detect parser runtime panics in FuzzParseExpr
Export ErrUnexpected from the parser package so the fuzz test can use
errors.Is to detect when the parser's recover() handler caught a
runtime panic. Previously these were silently swallowed; now
FuzzParseExpr fails on them.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-05-22 17:04:02 +02:00
Julien
141e0c00c7
Merge pull request #18576 from roidelapluie/roidelapluie/subsequence-rank
strutil/subsequence: rank exact matches above non-exact matches
2026-05-19 11:37:51 +02:00
Julien Pivotto
7b29b912e3 Revert "PromQL: Promote duration expressions as stable"
This reverts commit 1463a5bb5a.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-05-13 09:59:50 +02:00
Owen Williams
da1f89e736
tsdb(wal): st-per-sample for histograms initial code and benchmarks (#18221)
Implements ST for Histograms and Float Histograms (and their custom bucket cousins) in WAL. New tests, new benchmarks.

Part of https://github.com/prometheus/prometheus/issues/17790

```release-notes
[CHANGE] Adds Start Time value to all WAL Histogram samples in memory, and therefore may increase memory usage.
```

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2026-05-06 14:33:03 -04:00
Filip Boye-Kofi
6fc7f37c7a refactor: simplify of calling functions
Signed-off-by: Filip Boye-Kofi <Spuxy@seznam.cz>
2026-05-03 10:34:35 +02:00
Julien
e48be9d71a
Merge pull request #18575 from roidelapluie/roidelapluie/duration-expression-stable
PromQL: Promote duration expressions as stable
2026-04-27 14:46:08 +02:00
Linas Medžiūnas
45afb1d06e
perf(PromQL): make floatHistogram.KahanAdd inlineable on Go 1.26 (#18568)
* perf(PromQL): make kahansum.Inc inlineable on Go 1.26

Signed-off-by: linasm <linas.medziunas@gmail.com>
Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2026-04-27 08:43:13 +02:00
Julien Pivotto
a597d2250a strutil/subsequence: rank exact matches above non-exact matches
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-24 18:55:19 +02:00
Julien Pivotto
1463a5bb5a PromQL: Promote duration expressions as stable
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-24 18:45:09 +02:00
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