16097 Commits

Author SHA1 Message Date
Bryan Boreham
ceac4d2418 [PERF] PromQL: Walk syntax tree using iterator
Saves memory allocations. This is called a few times from the PromQL Engine.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-07-11 14:09:20 +01:00
Bryan Boreham
0339fbd5a3 [TESTS] PromQL: Add benchmark for PreprocessExpr
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2025-07-11 14:09:20 +01:00
Bryan Boreham
f1c6fab7e1
Merge pull request #14923 from prometheus/njpm/fix-mockIndex
tsdb tests: fix `mockIndex` implementation of `LabelValues` and `LabelNames`
2025-07-11 11:42:00 +01:00
George Krajcsovits
dae80e66a5
test(scrape): make nhcb scrape test more tolerant (#16862)
Fixes #16689
well, maybe not 100%, but should improve it.

Increase the scrape timeout to be more tolerant of slow test and
also use eventually when checking for targets.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-07-11 12:09:53 +02:00
George Krajcsovits
4662722a8e
chore(promql): improve doc string in promql/durations.go (#16863)
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-07-11 12:07:54 +02:00
dependabot[bot]
d5d601201e
build(deps): bump github.com/grpc-ecosystem/grpc-gateway/v2
---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/grpc-gateway/v2
  dependency-version: 2.27.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-11 10:04:09 +00:00
dependabot[bot]
a78f18c666
build(deps): bump github.com/ovh/go-ovh from 1.8.0 to 1.9.0
Bumps [github.com/ovh/go-ovh](https://github.com/ovh/go-ovh) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/ovh/go-ovh/releases)
- [Commits](https://github.com/ovh/go-ovh/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/ovh/go-ovh
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-11 10:03:35 +00:00
github-actions[bot]
a740285601
Merge pull request #16812 from prometheus/dependabot/go_modules/github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor-0.129.0
build(deps): bump github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor from 0.128.0 to 0.129.0
2025-07-11 12:01:47 +02:00
github-actions[bot]
f20e52828c
Merge pull request #16816 from prometheus/dependabot/go_modules/github.com/digitalocean/godo-1.155.0
build(deps): bump github.com/digitalocean/godo from 1.152.0 to 1.155.0
2025-07-11 11:57:59 +02:00
github-actions[bot]
c3a683d1bf
Merge pull request #16811 from prometheus/dependabot/go_modules/github.com/linode/linodego-1.52.2
build(deps): bump github.com/linode/linodego from 1.52.1 to 1.52.2
2025-07-11 11:57:34 +02:00
dependabot[bot]
74ec898bec
chore(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 (#16677)
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](f49aabe0b5...05b42c6244)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-11 11:57:05 +02:00
dependabot[bot]
489c22d5b6
chore(deps): bump actions/setup-go from 5.4.0 to 5.5.0 (#16678)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.4.0 to 5.5.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0aaccfd150...d35c59abb0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: 5.5.0
  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-07-11 11:56:37 +02:00
github-actions[bot]
dcdba5fc96
Merge pull request #16676 from prometheus/dependabot/github_actions/dependabot/fetch-metadata-2.4.0
chore(deps): bump dependabot/fetch-metadata from 2.3.0 to 2.4.0
2025-07-11 11:56:20 +02:00
github-actions[bot]
6a6682cec0
Merge pull request #16810 from prometheus/dependabot/github_actions/github/codeql-action-3.29.2
build(deps): bump github/codeql-action from 3.28.16 to 3.29.2
2025-07-11 11:55:29 +02:00
dependabot[bot]
07028d3cd5
chore(deps): bump golangci/golangci-lint-action from 7.0.0 to 8.0.0 (#16674)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](1481404843...4afd733a84)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-11 11:55:00 +02:00
dependabot[bot]
83b4cfdf5e
chore(deps): bump golangci/golangci-lint-action in /scripts (#16679)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](1481404843...4afd733a84)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-11 11:54:27 +02:00
github-actions[bot]
ce74e3918f
Merge pull request #16680 from prometheus/dependabot/github_actions/scripts/actions/setup-go-5.5.0
chore(deps): bump actions/setup-go from 5.4.0 to 5.5.0 in /scripts
2025-07-11 11:53:54 +02:00
Cristian Greco
3a5db2d442
ci: address golangci-lint issue with persist-credentials (#16861)
* ci: address golangci-lint issue with persist-credentials

Fixes the following zizmor warning:

```
warning[artipacked]: credential persistence through GitHub Actions artifacts
  --> scripts/golangci-lint.yml:26:9
   |
26 |         - name: Checkout repository
   |  _________-
27 | |         uses: actions/checkout@11bd71901b # v4.2.2
28 | |         # with:
29 | |         #   persist-credentials: false
   | |______________________________________- does not set persist-credentials: false
```

All other actions have been fixed in https://github.com/prometheus/prometheus/pull/16530

Credit to @jharvey10 who also addressed this particular issue in
a5bf67d897

Signed-off-by: Cristian Greco <cristian@regolo.cc>

* update golangci-lint to v2.2.1

Signed-off-by: Cristian Greco <cristian@regolo.cc>

---------

Signed-off-by: Cristian Greco <cristian@regolo.cc>
2025-07-11 11:53:32 +02:00
dependabot[bot]
bce1310f0f
build(deps): bump github.com/digitalocean/godo from 1.152.0 to 1.155.0
Bumps [github.com/digitalocean/godo](https://github.com/digitalocean/godo) from 1.152.0 to 1.155.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.152.0...v1.155.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-11 09:21:44 +00:00
github-actions[bot]
63980e763e
Merge pull request #16817 from prometheus/dependabot/go_modules/github.com/docker/docker-28.3.0incompatible
build(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.0+incompatible
2025-07-11 11:20:31 +02:00
github-actions[bot]
e401c11e43
Merge pull request #16813 from prometheus/dependabot/go_modules/google.golang.org/api-0.239.0
build(deps): bump google.golang.org/api from 0.238.0 to 0.239.0
2025-07-11 11:19:59 +02:00
Nicolás Pazos
b43a07248f tsdb tests: fix mockIndex implementation
Signed-off-by: Nicolás Pazos <npazosmendez@gmail.com>
2025-07-10 15:59:38 -03:00
Owen Williams
d2f1f4fb27
config: Add UnderscoreEscapingWithoutSuffixes translation strategy (#16849)
The last permutation of the translation options does underscore translation but does not add suffixes.
This translation option already exists in Mimir as otel_metric_suffixes_enabled, indicating external demand for this strategy.
There is an accompanying update to prometheus-docs to explain the use of this mode: https://github.com/prometheus/docs/pull/2688

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2025-07-10 11:27:23 -04:00
Björn Rabenstein
b7f984d6d2
Merge pull request #16585 from kapillamba4/fix/16393-strict
Convert PromQL tests to new syntax via basic migration mode
2025-07-10 15:45:38 +02:00
Björn Rabenstein
eb3ea163fa
promqltest: add tests for histogram_count(increase(...)) (#16854)
As `histogram_count` is playing tricks to improve performance, we
better make sure that the limitation of extrapolation below zero still
works as expected.

Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-10 15:44:02 +02:00
Charles Korn
8397b738bf
docs: clarify docs for PromQL aggregation operators (#16837)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-10 15:34:57 +02:00
Björn Rabenstein
362141370d
Merge pull request #16828 from prometheus/beorn7/histogram2
promql(histograms): scale a histogram the same as the count
2025-07-10 13:26:15 +02:00
Björn Rabenstein
0672a5b045
Merge pull request #16847 from prometheus/beorn7/promql
promqltest: Test NaN sample values for quantile aggregator
2025-07-10 11:16:12 +02:00
Dmitry Ponomaryov
b18272a572
Add template functions to support various use cases. (#16619)
Presumably, this will help with Loki alerts, but the added functionality is also generally useful.

For one, this enables `parseDuration` to also accept negative duration (as that's something that is also used in PromQL by now).

This also adds a function `now` to return the evaluation time of the template (as seconds since epoch AKA Unix time) and a function `toDuration` (akin to `toTime`), which creates a Go `time.Duration` from a duration in seconds.

---------

Signed-off-by: Dmitry Ponomaryov <me@halje.ru>
Signed-off-by: Dmitry Ponomaryov <iamhalje@gmail.com>
2025-07-10 00:33:20 +02:00
machine424
846acc10bb chore(tsdb): remove NewLeveledCompactorWithChunkSize constructor as unused, library users ca can redefine it on their side
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-07-09 17:10:13 +01:00
machine424
020e803ee0 chore(discovery): remove unused StaticProvider struct, library users can easily define it on their side
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-07-09 17:10:13 +01:00
George Krajcsovits
1d79f0f47e
chore(tsdb): add a few more testcases for unlock of unlocked mtx 16332 (#16848)
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-07-09 16:24:46 +02:00
Banana Duck
89f011ba13
fix: unlock of unlocked mutex (#16332)
* fix: unlock on unlocked mutex

Signed-off-by: Usama Alhanaqtah <a.usama@yandex.ru>

* test coverage

Signed-off-by: Usama Alhanaqtah <a.usama@yandex.ru>

---------

Signed-off-by: Usama Alhanaqtah <a.usama@yandex.ru>
Co-authored-by: alhanaqtah.usama <alhanaqtah.usama@DEV-254.local>
2025-07-09 15:37:55 +02:00
Björn Rabenstein
d86796863f
Merge pull request #16764 from bboreham/go-get-no-d
[BUILD] Don't specify -d for go get
2025-07-09 14:14:05 +02:00
beorn7
107e4a00c3 promqltest: Test NaN sample values for quantile aggregator
Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-09 13:38:19 +02:00
Bryan Boreham
eea203702c
Prepare release 3.5.0-rc.1 (#16845)
This RC reverts the feature "OTLP: Support promoting OTel scope attributes".

Add the line back into the CHANGELOG for 3.5.0-rc.0, since we are not changing that version.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
v3.5.0-rc.1
2025-07-09 12:07:27 +01:00
Björn Rabenstein
181415c7b7
Merge pull request #16846 from liangmulu/main
docs: fix some minor issues in comments
2025-07-09 13:00:13 +02:00
liangmulu
b1a7df2c0c chore: fix some minor issues in comments
Signed-off-by: liangmulu <liangmulu@outlook.com>
2025-07-09 18:05:41 +08:00
Kapil Lamba
df0e034314 address code review comments
Signed-off-by: Kapil Lamba <kapillamba4@gmail.com>
2025-07-09 07:25:31 +05:30
Björn Rabenstein
d8c921804e
Merge pull request #16824 from afhassan/main
tsdb: add count of histogram samples to block stats
2025-07-08 20:16:13 +02:00
Björn Rabenstein
dbee82267a
Merge pull request #16725 from MichaHoffmann/mhoffmann/fix-topk-nan-arg-error-on-nonexisting-series
promql: fix topk error on NaN argument for non-existing series
2025-07-08 19:42:20 +02:00
beorn7
bcf7a822a0 promql: Prevent extrapolation below zero for histogram count
This deals with the count field of native histograms in the same way
as with simple float counters. It then scale the whole histogram with
the same factor as it has scaled the count. This will still allow
individual buckets to get extrapolated below zero, but maybe that is
fine.

This implements approach (2) as described in
https://github.com/prometheus/prometheus/issues/15976#issuecomment-3032095158

Signed-off-by: beorn7 <beorn@grafana.com>
2025-07-08 19:01:31 +02:00
Vlad Shulcz
19fa1ed008
test(rulefmt): fix description annotation index in TestParseFileSuccessWithAliases (#16839)
Signed-off-by: shulcz <vshulcz@gmail.com>
2025-07-08 18:38:34 +02:00
Björn Rabenstein
c565e95808
Merge pull request #16825 from prometheus/beorn7/histogram
promql: add tests to demonstrate extrapolation below zero
2025-07-08 16:42:56 +02:00
chenlujjj
a2735494e1
chore: complete error message in RegisterSDMetrics function (#14635)
Signed-off-by: chenlujjj <953546398@qq.com>
2025-07-08 12:05:24 +00:00
Arthur Silva Sens
4b9d0fb92f
Revert: OTLP Support including scope metadata as metric labels (#16842)
Reverts #16730 and #16760

This is being done because we've noticed a problem in the spec that could
lead to name collisions if attributes name, version or schema_url are added
to the scope. They would collide with the already reserved labels
otel_scope_name, otel_scope_version and otel_scope_schema_url.

Since this new configuration option never made it into a release, we can
safely remove it from the 3.5 release. We'll sort this out for the 3.6 release

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2025-07-08 10:37:19 +00:00
Ahmed Hassan
01be7bfb2e add NumFloatSamples to TSDB block stats
Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com>
2025-07-07 13:48:18 -07:00
Lukasz Mierzwa
559fd44be6 Rename labels.go -> labels_slicelabels.go
labels.go is now holding slicelabels code, so let's rename it.

Signed-off-by: Lukasz Mierzwa <l.mierzwa@gmail.com>
2025-07-07 12:37:42 +01:00
machine424
ffcba01c5a chore: do not hardcode required versions in README.md
add links to the sources of truth.

It's hard to keep up to date, the "go" one
is "wrong" (not really as an old 1.22 binray could still
download/use newer toolchains...) for example.

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2025-07-07 08:42:31 +01:00
Charles Korn
1e58d792a5
storage/remote: fix "http: read on closed response body" errors if chunkedSeriesSet.Next is called again after the series set is exhausted (#16838)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-07 09:23:34 +02:00