Commit graph

15132 commits

Author SHA1 Message Date
Björn Rabenstein 4b01140207
doc: Update nodejs and npm requirements for build (#16082)
Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-26 17:20:42 +00:00
Jan Fajerski a7ce2c37b6
Merge pull request #16035 from Antiz96/reproducible_builds
build: Ignore timestamps recording in gzip metadata
2025-02-26 16:05:06 +01:00
Bryan Boreham 42d55505f9
Merge pull request #12659 from prymitive/memChunk
Short-cut common memChunk operations
2025-02-25 11:33:56 +00:00
boforetech 6ec89f14c7
refactor: use a more straightforward return value (#16070)
Signed-off-by: beforetech <mail@before.tech>
2025-02-24 12:25:57 +00:00
Julius Volz e837ac9fe2
Merge pull request #16068 from prometheus/fix/target-health-highlighting
Fix health color for target pools with single target that is down
2025-02-22 22:47:41 +01:00
Julius Volz b636046672 Fix health color for target pools with single target that is down
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-02-22 21:32:56 +01:00
Björn Rabenstein 7bbbb5cb97
Merge pull request #16006 from mmorel-35/revive/unused-parameter
chore: enable unused-parameter from revive
2025-02-21 13:56:04 +01:00
Charles Korn 8356990709
promql: fix double quoting in invalid label name error from count_values (#16054)
Some checks failed
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 / 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 / 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
promql: fix double quoting in invalid label name error from `count_values`

---------

Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charleskorn@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-02-21 00:37:04 +01:00
Ian Kerins 8c8b83ed4e
doc: fix broken kuma.io link (#16028)
doc: fix broken kuma.io link

I'm not actually familiar with kuma, but I noticed this link was broken, and I believe the one I've found here is equivalent.

Signed-off-by: Ian Kerins <git@isk.haus>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-02-20 23:14:33 +01:00
Björn Rabenstein fcc8e49d65
Merge pull request #16018 from charleskorn/charleskorn/quantile_over_time-annotation
promql: emit correct annotation in `quantile_over_time` when run over a range with histograms and floats
2025-02-20 22:49:30 +01:00
Owen Williams 23af3463e5
Merge pull request #16061 from matthewhughes-uw/fix-escaping-unconditionally-set
scraper: fix UTF-8 scraping header always sent with PrometheusText1.0.0
2025-02-20 10:52:12 -05:00
Jan Fajerski cd892ea2f8
Merge pull request #16057 from jan--f/build-all-status-trigger
ci: fix build-all status trigger to contain always
2025-02-20 12:48:25 +01:00
Matt Hughes 5868e36d91 scraper: fix UTF-8 scraping header always sent with PrometheusText1.0.0
The `Accept` header should not include `escape=allow-utf-8` unless
explicitly requested.

Conveniently, there was already a test covering this header's value, it
just required updating so it also asserts that this value in the header
is not set in the cases we don't expect it to be set. I also converted
those tests into table tests to help make failures clearer.

Issue: https://github.com/prometheus/prometheus/issues/15857
Signed-off-by: Matt Hughes <mhughes@uw.co.uk>
2025-02-20 11:33:16 +00:00
Jan Fajerski d5b18be9e2 ci: fix build-all status trigger to contain always
Otherwise a failure in the dependent job skips the status job, which is
treated as success.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2025-02-20 11:41:24 +01:00
Matthieu MOREL c7d4b53ec1 chore: enable unused-parameter from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-19 19:50:28 +01:00
김가윤 86bb04783c
Example config: Add labels to static_configs (#13327)
Signed-off-by: 김가윤 <60080153+KaYunKIM@users.noreply.github.com>
Co-authored-by: Bryan Boreham <bjboreham@gmail.com>
2025-02-19 15:24:30 +00:00
Ayoub Mrini e04913aea2
Merge pull request #15778 from machine424/reuse-pools
feat(tsdb/(head|agent)): reuse pools across segments to reduce garbage during WL replay
2025-02-17 12:48:17 +01:00
Julien Duchesne 77a5698190
Ruler Concurrency: Consider __name__ matchers (#16039)
When calculating dependencies between rules, we sometimes run into `{__name__...}` matchers
These can be used the same way as the actual rule names
This will enable even more rules to run concurrently

The new logic is also not slower:
```
julienduchesne@triceratops prometheus % benchstat test-old.txt test.txt
goos: darwin
goarch: arm64
pkg: github.com/prometheus/prometheus/rules
cpu: Apple M3 Pro
                 │ test-old.txt │              test.txt               │
                 │    sec/op    │   sec/op     vs base                │
DependencyMap-11    1.206µ ± 7%   1.024µ ± 7%  -15.10% (p=0.000 n=10)

                 │ test-old.txt │               test.txt               │
                 │     B/op     │     B/op      vs base                │
DependencyMap-11   1.720Ki ± 0%   1.438Ki ± 0%  -16.35% (p=0.000 n=10)

                 │ test-old.txt │              test.txt              │
                 │  allocs/op   │ allocs/op   vs base                │
DependencyMap-11     39.00 ± 0%   34.00 ± 0%  -12.82% (p=0.000 n=10)
```

Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com>
2025-02-17 11:19:16 +00:00
Robin Candau ef24d47df9
build: Ignore timestamps recording in gzip metadata
Use the `-n / --noname` option to ignore non-deterministric information, such as timestamps, in gzip metadata.

This is required for [reproducible builds](https://reproducible-builds.org/).

Signed-off-by: Robin Candau <robincandau@protonmail.com>
2025-02-13 18:22:39 +01:00
Laimis Juzeliūnas a5ffa83be8
scrape: reorder the switch case of errors (#15991)
Change case order for switch scrapeLoop

This commit changes the ordering in error identification switch cases for better production performance and adds reasonings behind error switch case order as comments.

---------

Signed-off-by: Laimis Juzeliūnas <asnelaimis@gmail.com>
2025-02-13 14:25:50 +01:00
Björn Rabenstein e936e419b0
Merge pull request #16009 from charleskorn/topk-bottomk-sorting
docs: make sorting behaviour of `topk` and `bottomk` explicit
2025-02-13 13:53:51 +01:00
Bartlomiej Plotka de23a9667c
prw2: Split PRW2.0 from metadata-wal-records feature (#16030)
Rationales:

* metadata-wal-records might be deprecated and replaced going forward: https://github.com/prometheus/prometheus/issues/15911
* PRW 2.0 works without metadata just fine (although it sends untyped metrics as expected).

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-02-13 12:16:33 +00:00
Bartlomiej Plotka 733a5e9eb4
textparse: Optimized protobuf parser with custom streaming unmarshal. (#15731)
* textparse: Optimized protobuf parser with custom streaming decoder.

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

Update model/textparse/protobufparse.go

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

Addressing comments.

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

decoder: reuse histograms and summaries.

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

optimize help returning (5% of mem utilization).

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

Apply suggestions from code review

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

Update prompb/io/prometheus/client/decoder.go

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

Fix build.

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

* Update model/textparse/protobufparse.go

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

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2025-02-13 10:38:35 +00:00
frazou 9b4c8f6be2
rulefmt: support YAML aliases for Alert/Record/Expr (#14957)
* rulefmt: add tests with YAML aliases for Alert/Record/Expr

Altough somewhat discouraged in favour of using proper configuration
management tools to generate full YAML, it can still be useful in some
situations to use YAML anchors/aliases in rules.

The current implementation is however confusing: aliases will work
everywhere except on the alert/record name and expr

This first commit adds (failing) tests to illustrate the issue, the next
one fixes it. The YAML test file is intentionally filled with anchors
and aliases. Although this is probably not representative of a real-world
use case (which would have less of them), it errs on the safer side.

Signed-off-by: François HORTA <fhorta@scaleway.com>

* rulefmt: support YAML aliases for Alert/Record/Expr

This fixes the use of YAML aliases in alert/recording rule names and
expressions. A side effect of this change is that the RuleNode YAML type is
no longer propagated deeper in the codebase, instead the generic Rule type
can now be used.

Signed-off-by: François HORTA <fhorta@scaleway.com>

* rulefmt: Add test for YAML merge combined with aliases

Currently this does work, but adding a test for the related
functionally here makes sense.

Signed-off-by: David Leadbeater <dgl@dgl.cx>

* rulefmt: Rebase to latest changes

Signed-off-by: David Leadbeater <dgl@dgl.cx>

---------

Signed-off-by: François HORTA <fhorta@scaleway.com>
Signed-off-by: David Leadbeater <dgl@dgl.cx>
Co-authored-by: David Leadbeater <dgl@dgl.cx>
2025-02-13 20:48:33 +11:00
Nicolas Peugnet 898af6102d
promtool: support creating tsdb blocks from a pipe (#16011)
This is very useful when piping the input file to stdin and then using
/dev/stdin as the input file. e.g.

    xzcat dump.xz |
    	promtool tsdb create-blocks-from openmetrics /dev/stdin /tmp/data

Signed-off-by: Nicolas Peugnet <nicolas.peugnet@lip6.fr>
2025-02-13 13:03:31 +11:00
Aman 509b978f0d
single-button-theme-toggle-and-responsive-logo (#16021)
Signed-off-by: amanycodes <amanycodes@gmail.com>
2025-02-12 17:14:05 +00:00
Bartlomiej Plotka 8fe24ced82
ci: Add GH action that clicks "enable auto-merge" on dependabot PRs (#15967)
This will merge on green all non-conflicting dependabot PRs.

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-02-12 16:51:40 +00:00
Bartlomiej Plotka 00b69efabb
model/textparse: Change parser interface Metric(...) string to Labels(...) (#16012)
* model/textparse: Change parser interface Metric(...) string to Labels(...)

Simplified the interface given no one is using the return argument.
Renamed for clarity too.

Found and discussed https://github.com/prometheus/prometheus/pull/15731#discussion_r1950916842

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

* Fixed comments; optimized not needed copy for om and text.

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

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-02-12 15:47:56 +00:00
Gabriel Bernal a323c23332
set ttlAutopurge to true as ttl is set for codemirror prometheus client cache (#16024)
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
2025-02-12 15:08:45 +00:00
Julius Volz a944fa1e7a
Make theme switcher a single three-state toggle button (#16000)
This should help a bit with the header icon overflow on narrow screens and
also overall make things look less cluttered.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-02-12 15:56:00 +01:00
Charles Korn 0964b6e584
promql: emit correct annotation in quantile_over_time when run over a range with histograms and floats
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-12 16:46:57 +11:00
Björn Rabenstein 906f6a33b6
Merge pull request #15987 from prometheus/beorn7/histogram
promql: Fix counter reset detection in subqueries with histograms
2025-02-11 20:41:19 +01:00
Björn Rabenstein 13c05a385c
Merge pull request #16007 from mmorel-35/revive/early-return
chore: enable early-return from revive
2025-02-11 20:31:34 +01:00
beorn7 14bb63c467 promql: Fix counter reset detection in subqueries with histograms
Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-11 20:04:10 +01:00
beorn7 6518941d73 promql: Expose problem with histogram counter resets in subquery
Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-11 20:04:10 +01:00
Bartlomiej Plotka 8baad1a73e
Bump promci to latest to avoid deprecated actions/cache CI issue. (#16013)
Current main is broken due to:

```
Error: This request has been automatically failed because it uses a deprecated version of `actions/cache: 0c45773b623bea8c8e75f6c82b208c3cf94ea4f9`. Please update your workflow to use v3/v4 of actions/cache to avoid interruptions. Learn more: https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down
```

This is odd given `actions/cache: 0c45773b623bea8c8e75f6c82b208c3cf94ea4f9` has a comment of v4.0.2 (so not v1 and v2), trying 4.1.0.

https://github.com/prometheus/prometheus/actions/runs/13267052807/job/37037025130?pr=16011

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-02-11 18:09:21 +00:00
Ayoub Mrini de6add2c7d
Merge pull request #14228 from Codelax/sd-scaleway-routed-ips
feat(scaleway-sd): add labels for multiple public IPs
2025-02-11 17:21:29 +01:00
jub0bs 329ec6831a
util/httputil: reduce heap allocations in newCompressedResponseWriter (#16001)
* util/httputil: Benchmark newCompressedResponseWriter

This benchmark illustrates that newCompressedResponseWriter incurs a
prohibitive amount of heap allocations when handling a request containing a
malicious Accept-Encoding header.¬

Signed-off-by: jub0bs <jcretel-infosec+github@protonmail.com>

* util/httputil: Improve newCompressedResponseWriter

This change dramatically reduces the heap allocations (in bytes)
incurred when handling a request containing a malicious Accept-Encoding header.

Below are some benchmark results; for conciseness, I've omitted the name of the
benchmark function (BenchmarkNewCompressionHandler_MaliciousAcceptEncoding):

```
goos: darwin
goarch: amd64
pkg: github.com/prometheus/prometheus/util/httputil
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
│     old     │                 new                 │
│   sec/op    │   sec/op     vs base                │
  18.60m ± 2%   13.54m ± 3%  -27.17% (p=0.000 n=10)

│       old        │                 new                 │
│       B/op       │    B/op     vs base                 │
  16785442.50 ± 0%   32.00 ± 0%  -100.00% (p=0.000 n=10)

│    old     │                new                 │
│ allocs/op  │ allocs/op   vs base                │
  2.000 ± 0%   1.000 ± 0%  -50.00% (p=0.000 n=10)
```

Signed-off-by: jub0bs <jcretel-infosec+github@protonmail.com>

---------

Signed-off-by: jub0bs <jcretel-infosec+github@protonmail.com>
2025-02-11 14:14:55 +01:00
Charles Korn 2cfd402b3a
Clarify sorting behaviour of topk and bottomk.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-11 14:55:39 +11:00
Charles Korn acd74b02fb
Fix typo
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-11 14:46:03 +11:00
machine424 d644324407
feat(tsdb/(head|agent)): reuse pools across segments to avoid generating garbage during WL replay
This is part of the "reduce WAL replay overhead/garbage" effort to help with https://github.com/prometheus/prometheus/issues/6934.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-02-10 22:40:24 +01:00
Matthieu MOREL b472ce7010 chore: enable early-return from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-02-10 22:08:43 +01:00
Bryan Boreham b74cebf6bf
Merge pull request #12920 from prymitive/compactLock
Fix locks in db.reloadBlocks()
2025-02-10 17:35:09 +00:00
Bartlomiej Plotka 8cd9069cf1
textparse: Refactor benchmark testdata for all types. (#15998)
Also:
* split benchmark functions to make sure no one compares across parsers.
* testdata file have meaningful names reflecting the type representation
* promtestdata.txt now has all types, taken directly from long running Prometheus (https://demo.do.prometheus.io/)

Needed for https://github.com/prometheus/prometheus/pull/15731

Signed-off-by: bwplotka <bwplotka@gmail.com>
2025-02-10 12:26:18 +00:00
Julius Volz 402fa38e84
Improve tick rendering (#15999)
Move to 24h-based time formatting and unambiguous date formats. Also add
more details to the default formatting of each tick instead of only showing
e.g. minutes/seconds at rollover ticks for the shorter breakpoints.

Fixes https://github.com/prometheus/prometheus/issues/15913

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-02-10 13:19:56 +01:00
Matthias Loibl b0d82e4c24
Merge pull request #15826 from obliadp/fix/mixin-clusterLabel
mixin: replace use of 'cluster' with clusterLabel variable in dashboards
2025-02-10 11:29:26 +00:00
Björn Rabenstein 585a219622
Merge pull request #15845 from prometheus/beorn7/doc
docs: Update PromQL documentation to match the native histogram spec
2025-02-08 00:24:29 +01:00
beorn7 993d4e71c9 docs: Update PromQL documentation to match the native histogram spec
This is also meant to document the actual implementation, but
see #13934 for the current state.

This also improves and streamlines some parts of the documentation
that are not strictly native histogram related, but are colocated with
them. In particular, the section about aggregation operators got
restructured quite a bit, including the removal of a quite verbose
example for `limit_ratio` (which was just too long an this location
and also a bit questionabl in its usefulness).

Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-07 22:47:59 +01:00
dependabot[bot] 78055a5932
chore(deps): bump github.com/digitalocean/godo from 1.132.0 to 1.136.0 (#15920)
Bumps [github.com/digitalocean/godo](https://github.com/digitalocean/godo) from 1.132.0 to 1.136.0.
- [Release notes](https://github.com/digitalocean/godo/releases)
- [Changelog](https://github.com/digitalocean/godo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalocean/godo/compare/v1.132.0...v1.136.0)

---
updated-dependencies:
- dependency-name: github.com/digitalocean/godo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-07 21:40:03 +01:00
dependabot[bot] 9c5fd0b9fb
chore(deps): bump actions/setup-go from 5.2.0 to 5.3.0 (#15957)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](3041bf56c9...f111f3307d)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-07 19:10:17 +00:00