Commit graph

17458 commits

Author SHA1 Message Date
Julien Pivotto
3ac87e75bf chore: Add OpenAPI viewer
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-24 14:54:15 +02:00
Julien
9c89645d87
Merge pull request #18497 from roidelapluie/roidelapluie/search_api_part1
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
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
storage: introduce search interface with scoring and filtering
2026-04-23 15:33:01 +02:00
Julien Pivotto
f69db5bc54 storage: introduce search interface with scoring and filtering
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-23 15:05:48 +02:00
Julien
3b9caf6564
Merge pull request #18569 from roidelapluie/roidelapluie/labelnames-limit
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
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
tsdb: apply LabelNames limit from LabelHints in blockBaseQuerier
2026-04-23 12:28:19 +02:00
Julien Pivotto
a5b5a3329c tsdb: apply LabelNames limit from LabelHints in blockBaseQuerier
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-23 11:05:17 +02:00
George Krajcsovits
c84b0acdb4
test(tsdb): add OOO error coverage for ST zero sample appends (#18554)
* test(tsdb): add OOO error coverage for ST zero sample appends

Add unit tests exercising the out-of-order error paths in
AppendSTZeroSample, AppendHistogramSTZeroSample (AppenderV1), and
the best-effort ST injection in AppenderV2.Append.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>

* make format

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>

* test(tsdb): add TestHeadAppenderV2_BestEffortSTZeroSample_OOO

The three OOO cases added to TestHeadAppenderV2_Append_EnableSTAsZeroSample
use a single appender so headChunks is nil at append time; the zero sample
enters the batch and is rejected silently in commitFloats, never reaching
the error-handling branch at line 374 of bestEffortAppendSTZeroSample.

Add a dedicated test that commits the first sample before appending the
second. This makes headChunks non-nil, so appendFloat/appendHistogram/
appendFloatHistogram returns ErrOutOfOrderSample at append time and the
branch at line 374 is actually executed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>

---------

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:48:12 +02:00
Julien
be5db19c73
Merge pull request #18563 from roidelapluie/roidelapluie/promql-extrapolatedrate-parens
Some checks failed
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
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Push README to Docker Hub / Push README to Docker Hub (push) Has been cancelled
Push README to Docker Hub / Push README to quay.io (push) Has been cancelled
promql: add parens to clarify operator precedence in extrapolatedRate
2026-04-22 15:45:48 +02:00
Julien
1b06a28958
Merge pull request #18565 from prometheus/superq/fix_govulncheck
Fix typo in README
2026-04-22 15:44:25 +02:00
SuperQ
5ace2dacdc
Fix typo in README
Fix govulncheck typo in build status badge.

Signed-off-by: SuperQ <superq@gmail.com>
2026-04-22 14:55:18 +02:00
Julien
89f5f51f46
Merge pull request #18538 from roidelapluie/roidelapluie/fixreturn
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
Push README to Docker Hub / Push README to Docker Hub (push) Waiting to run
Push README to Docker Hub / Push README to quay.io (push) Waiting to run
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
web/api: return after respondError in serveWALReplayStatus
2026-04-22 12:27:26 +02:00
Julien Pivotto
dffe5b3b2e promql: add parens to clarify operator precedence in extrapolatedRate
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-22 12:06:17 +02:00
Julien
feff421723
Merge pull request #18562 from roidelapluie/roidelapluie/fix-isstarttimestampreset
promql: fix spurious reset when prevST is invalid in isStartTimestampReset
2026-04-22 10:46:45 +02:00
Julien Pivotto
678e3b3763 promql: fix spurious reset when prevST is invalid in isStartTimestampReset
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-22 10:08:23 +02:00
Ben Kochie
7475a07d82
Enable govulncheck in CI (#18553)
Add a CI job to run govulncheck.
* Run daily.
* Run when touching go.{mod,sum}.on PRs and merge to the default branch.
* Cleanup unused / broken govulncheck in Makefile.common.
* Add status badge.
* Add to repo sync for all Go projects.
* Reduce green lines in sync script to make it easier to read the log.

Signed-off-by: SuperQ <superq@gmail.com>
2026-04-22 09:14:54 +02:00
Björn Rabenstein
32e5d332bc
Add kgeckhart as agent maintainer and codeowner (#18536)
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: Kyle Eckhart <kgeckhart@users.noreply.github.com>
2026-04-21 18:22:11 +02:00
Vilius Pranckaitis
321fe34aab
PromQL: use start timestamps for rate()-like calculations (#18344)
* PromQL: use start timestamps for rate() and increase() calculations

* implement start timestamps reset detection for `irate()`
* add `start_timestamps.test`
* add a couple of tests with subqueries
* add a test for cumulative with unknown start timestamp
* update `enable-features` CLI parameter description
* `make cli-documentation`

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

---------

Signed-off-by: Vilius Pranckaitis <vpranckaitis@gmail.com>
Signed-off-by: vpranckaitis <vpranckaitis@gmail.com>
2026-04-21 17:43:40 +02:00
GeorgeTyupin
e0ea05665a
cmd/prometheus: add default values for agent min/max retention flags (#18261)
* cmd/prometheus: add default values for agent min/max retention flags

Signed-off-by: GeorgeTyupin <GeorgyTyupin@ya.ru>

* docs: update command-line flags documentation

Signed-off-by: GeorgeTyupin <GeorgyTyupin@ya.ru>

* chore: trigger CI (retry 4)

Signed-off-by: GeorgeTyupin <GeorgyTyupin@ya.ru>

* Reuse db.go constants for agent retention flags to avoid duplication.

Signed-off-by: GeorgeTyupin <GeorgyTyupin@ya.ru>

---------

Signed-off-by: GeorgeTyupin <GeorgyTyupin@ya.ru>
2026-04-21 13:22:15 +02:00
Julien
40efbd55b9
Merge pull request #18539 from roidelapluie/roidelapluie/scwrt
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
discovery/scaleway: use http.Client instead of RoundTripper, enabling follow_redirects support
2026-04-21 10:09:37 +02:00
Ayoub Mrini
83962c35a4
test(cmd/prometheus): add TestFeatureFlagsDocumented and adjust --enable-feature description (#18487)
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
* test(cmd/prometheus): add TestFeatureFlagsDocumented and fix help text

Add TestFeatureFlagsDocumented to ensure the --enable-feature help text
in and docs/feature_flags.md list the same set of flags.

The help text was out of sync with the documentation:
- Flags present in docs but missing from help text: `auto-reload-config`,
  `metadata-wal-records`, `otlp-native-delta-ingestion`,
  `promql-delayed-name-removal`, `type-and-unit-labels`. Added them.
- Flags present in help text but missing from docs: `auto-gomaxprocs`,
  `expand-external-labels`. Removed them.

The help text is now sorted for better readability and kept in sync
with the documentation.

Also, the parsing of an empty `--enable-feature` was changed to
print `msg="Unknown option for --enable-feature" option=""` instead of nothing.

Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>

* main.go remove default for --enable-feature to avoid unwanted

Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>

---------

Signed-off-by: Ayoub Mrini <ayoubmrini424@gmail.com>
2026-04-20 16:08:42 +02:00
Julien
57821524d5
Merge pull request #18548 from roidelapluie/roidelapluie/remove-registry-arch-exclusions
build: remove DOCKER_REGISTRY_ARCH_EXCLUSIONS and DOCKERFILE_ARCH_EXCLUSIONS logic
2026-04-20 12:12:02 +02:00
Julien Pivotto
dd03bb4476 build: remove DOCKERFILE_ARCH_EXCLUSIONS logic
Upstream distroless now supports all architectures, so there is no
longer a need to exclude specific dockerfile/arch combinations from
the build.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-20 11:44:25 +02:00
Julien Pivotto
7f31983569 build: remove DOCKER_REGISTRY_ARCH_EXCLUSIONS logic
This mechanism was introduced to skip pushing riscv64 images to
registries that were misconfigured to not accept that architecture.
The misconfiguration has now been fixed across all repositories, so
this workaround is no longer needed.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-20 10:23:09 +02:00
Julien
de717d30c2
Merge pull request #18545 from gaganhr94/fix/token-permissions
fix: adding required permissions to top level and jobs in the workflow
2026-04-20 10:12:01 +02:00
Gagan H R
bfcaa44c2c fix: adding required permissions to top level and jobs in the workflow
Signed-off-by: Gagan H R <hrgagan4@gmail.com>
2026-04-19 11:41:48 +00:00
Julien
f39fff9691
Merge pull request #18537 from roidelapluie/roidelapluie/roidelapluie/funcs-ui
promql/ui: highlight start()/end()/range()/step() as functions; start () /end() as modifiers only after @
2026-04-17 18:35:34 +02:00
Arve Knudsen
c7b2210ac3
tsdb: cache collected head chunks on ChunkReader for O(1) lookup (#18302)
tsdb: cache collected head chunks on ChunkReader for O(1) lookup

The query path calls s.chunk() once per chunk meta via
ChunkOrIterableWithCopy. Each call walks the head chunks linked list
from the head to the target position. For a series with N head chunks
iterated oldest-first, total work is O(N²).

Cache the collected []*memChunk slice on headChunkReader, keyed by
series ref, head pointer, and mmapped chunks length. Collected once
per series under lock; reused on subsequent chunk lookups for the same
series. The backing array is reused across series (zero alloc after
first use).

Series with 0 or 1 head chunks skip the cache entirely to avoid
per-series overhead that dominates for typical workloads where most
series have a single head chunk.

The cache is gated behind an enableCache flag, toggled via an optional
chunkCacheToggler interface only when hints.Step > 0 (range queries).
Instant queries only need one chunk per series, so the cache overhead
is not recouped.

Also replace O(N²) linked-list traversals in appendSeriesChunks with
O(N) collectHeadChunks + slice iteration, and thread reusable
headChunksBuf through the index reader paths to avoid per-series
allocations.


---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2026-04-17 18:34:41 +02:00
Julien Pivotto
ddca8ee45a discovery/scaleway: use http.Client instead of RoundTripper, enabling follow_redirects support
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-17 18:01:44 +02:00
Julien
ff144f16fb
Merge pull request #18531 from roidelapluie/roidelapluie/smoothed-vector-binop
promql: fix smoothSeries() @ modifier timestamp mismatch
2026-04-17 17:05:50 +02:00
Julien Pivotto
c20c88e0db web/api: return after respondError in serveWALReplayStatus
Without the return, a successful respond() call would always follow
the error response, writing a second body to an already-written
ResponseWriter and producing a malformed HTTP response.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-17 17:03:25 +02:00
Julien Pivotto
504c5e67ea promql/ui: highlight start()/end()/range()/step() as functions; start()/end() as modifiers only after @
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-17 16:48:54 +02:00
Julien
4c50ef989d
Update promql/promqltest/testdata/extended_vectors.test
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Julien <291750+roidelapluie@users.noreply.github.com>
2026-04-17 16:38:36 +02:00
Kyle Eckhart
7b3c424ec3 Add kgeckhart as agent maintainer and codeowner
Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
2026-04-17 08:26:05 -04:00
Julien
5d0bc055ef
Merge pull request #17877 from roidelapluie/roidelapluie/funcs
PromQL: Add start() end() range() and step() functions
2026-04-17 13:51:37 +02:00
Julien Pivotto
85dbc3cc76 promql: fix smoothSeries() @ modifier timestamp mismatch
smoothSeries() was stamping output points at offset-adjusted timestamps
instead of evaluator timestamps. When the @ modifier is used, this
causes gatherVector() to miss the points because it matches by exact
timestamp equality against evaluator step timestamps.

Fix by iterating over evaluator timestamps and deriving data timestamps
by subtracting the offset, so output points align with what
gatherVector() expects.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-16 13:44:58 +02:00
Julien Pivotto
ae9e52c868 PromQL: Add start() end() range() and step() functions
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-16 10:59:23 +02:00
Ben Kochie
25d678b502
Cleanup promci action (#18524)
Use new `promci-setup` action for version upgrade test job.

Signed-off-by: SuperQ <superq@gmail.com>
2026-04-16 10:19:05 +02:00
Ben Kochie
a2e000133b
Fix quay.io riscv64 publishing (#18527)
Because quay.io requires manual creation of new repos, we missed
creating one for riscv64. This has been created so publish should now
work.

Signed-off-by: SuperQ <superq@gmail.com>
2026-04-16 10:14:00 +02:00
Julien
c4c1c55a82
Merge pull request #18523 from roidelapluie/roidelapluie/smoothed-rate
promql: fix smoothed rate returning zero for data only after range
2026-04-16 10:00:46 +02:00
Julien
f1c02cc7f1
Merge pull request #18420 from roidelapluie/roidelapluie/fuzzing-jobs
chore(fuzzing): limit number of CI jobs
2026-04-16 09:36:24 +02:00
Julien Pivotto
93ec767fed promql: fix smoothed rate returning zero for data only after range
For smoothed rate/increase, a result should only be returned
when there is data available to interpolate across the range. If the
range has a single data point only on one side, the result is
meaningless and should be empty.

The "data only before" case was already handled: if the last fetched
sample is at or before rangeStart, extendedRate returns nothing.

Add the symmetric guard for the "data only after" case: if the first
fetched sample is strictly after rangeEnd, return nothing as well.

This mirrors the behaviour described in prometheus/prometheus#18295,
where a smoothed rate that has no data before the range should not
return zero.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2026-04-16 09:34:16 +02:00
Julius Volz
34cebfe953
Merge pull request #18411 from prometheus/self-metrics-api
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 for Prometheus upgrades and downgrades (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 (push) Has been cancelled
CI / 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
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (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
Add API endpoint for getting Prometheus' metrics about itself
2026-04-15 14:47:38 +02:00
Julien
6e83b49dd6
Merge pull request #17685 from akshatsinha0/fix-aws-sd-setdirectory
Fix(discovery/aws): Added SetDirectory method to EC2SDConfig.
2026-04-15 14:35:46 +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
Arve Knudsen
98809e40c6
tsdb: Skip clean series during periodic head chunk mmap (#18272)
tsdb: Skip clean series during periodic head chunk mmap

The periodic mmapHeadChunks cycle previously acquired a per-series
lock on every series, even though typically >99% have nothing to
mmap. This was identified as a CPU bottleneck in Grafana Mimir.

Add a headChunkCount field (sync/atomic.Uint32) to memSeries that
tracks the number of head chunks. It is incremented in
cutNewHeadChunk and the histogram new-chunk paths, and reset by
mmapChunks and truncateChunksBefore. mmapHeadChunks uses a lock-free
Load to skip series with fewer than 2 head chunks, avoiding the
per-series lock for clean series.

sync/atomic.Uint32 (4 bytes) is used instead of go.uber.org/atomic
(8 bytes) to fit in existing struct padding without growing
memSeries. Chunk counts are bounded by the 3-byte field in
HeadChunkRef, so cannot overflow uint32.

Also fix pre-existing comment inaccuracies in the touched code:
headChunks.next -> headChunks.prev, mmapHeadChunks() -> mmapChunks()
in the doc comment, and a grammar error.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2026-04-14 17:11:35 +02: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