Commit graph

12996 commits

Author SHA1 Message Date
Oleg Zaytsev 6ebda5a7bc
Optimize Matcher.String()
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-08 17:05:27 +02:00
Oleg Zaytsev dabd789fd5
Quote label name in matchers when needed
When the label name of a matcher contains non-standard characters, like
a dot, or starts with a digit, it should be quoted.

If it's not quoted, then `VectorSelector.String()` isn't a valid PromQL.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-08 16:58:51 +02:00
Arve Knudsen 0ba747187d
Merge pull request #14020 from aknuds1/arve/direct-otlp
prometheusremotewrite: Move TimeSeries method to timeseries.go
2024-05-08 15:03:57 +02:00
Björn Rabenstein 178935d0e9
Merge pull request #14043 from aknuds1/arve/chunkenc-refactor
tsdb/chunkenc.Pool: Refactor Get and Put
2024-05-08 15:03:18 +02:00
Bryan Boreham b3c15d2246 test: clean up promqltest package references
So it nearly compiles.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham 9aa321d672 test: make field initializers explicit
Lint started complaining after I moved the file.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham ccf73266f0 test: move promqltest tests together with the implementation
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham 11b27d5d22 test: move test files into new promqltest package
So that promql package does not bring in test-only dependencies.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham a6e427660a test: check for @-modifier without using engine internals
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham 2b0c87b1b6 test: turn TestKahanSum into scripted test
This saves having a function solely to call kahanSumInc.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:55 +01:00
Bryan Boreham a1af3c27d4 refactor: extract almost.Equal() to new package
To avoid a circular reference between promql and promqltest.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 13:42:10 +01:00
Arve Knudsen 108a6bc9f6 tsdb/chunkenc.Pool: Refactor Get and Put
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-05-08 13:37:25 +02:00
Arthur Silva Sens df05132f19 Prepare v2.52.0 release
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
2024-05-08 07:37:25 -03:00
Arve Knudsen a25160e6a4
[REFACTOR] PromQL: simplify rangeEvalTimestampFunctionOverVectorSelector (#14021)
The function `rangeEvalTimestampFunctionOverVectorSelector` appeared to be checking histogram size, however the value it used was always 0 due to subtle variable shadowing.
However we don't need to pass sample values to the `timestamp` function, since the latter only cares about timestamps. This also affects peak sample count in statistics, since we are no longer copying histogram samples.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-05-08 10:39:44 +01:00
Pranshu Srivastava 87427682fd
bugfix: allow opting-out of multi-cluster setups
Allow users to opt-out of the multi-cluster setup for Prometheus
dashboard, in environments where it isn't applicable.

Refer: https://github.com/prometheus/prometheus/pull/13180.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2024-05-07 23:46:10 +05:30
Oleg Zaytsev 2524a91591
Fix FastRegexMatcher matching multibyte runes with . (#14059)
When `zeroOrOneCharacterStringMatcher` wach checking the input string,
it assumed that if there are more than one bytes, then there are more
than one runes, but that's not necessarily true.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-07 16:33:37 +02:00
Oleg Zaytsev 4b7a44c7a0
Fix parser.VectorSelector.String() with empty name matcher (#14015)
The check fell into "this matcher equals vector selector's name" case when vector selector doesn't have a name and the matcher is an explicit matcher for an empty __name__ label.

To provide some context about why this is important: some downstream projects use the promql.Parse(expr.String()) to clone an expression's AST, and with this bug that matcher disappears in the cloning.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-06 11:51:08 +02:00
Arthur Silva Sens 93be83069e
Merge pull request #14051 from prometheus/resolve-conflicts-2.52
Merge `release-2.52` back to main
2024-05-03 14:53:56 -03:00
Arthur Silva Sens 2e323af50f
Merge branch 'main' into resolve-conflicts-2.52
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-05-03 14:36:38 -03:00
Arthur Silva Sens 48e6e16943
Prepare v2.52.0-rc.1 release (#14050)
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-05-03 17:31:50 +00:00
AVejahat 56fd8a1e4a
bugfix: add missing comma in vector/matrix array (#14047)
* bugfix: Add missing comma when encoding JSON results in web API

---------

Signed-off-by: Amir Vejahat <amir.vejahat.av@gmail.com>
Co-authored-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-05-03 14:07:49 -03:00
gotjosh c10186eeea
BUGFIX: Mark the rule's restoration process as completed always (#14048)
* BUGFIX: Mark the rule's restoration process as completed always

In https://github.com/prometheus/prometheus/pull/13980 I introduced a change to reduce the number of queries executed when we restore alert statuses.

With this, the querying semantics changed as we now need to go through all series before we enter the alert restoration loop and I missed the fact that exiting early when there are no rules to restore would lead to an incomplete restoration.

An alert being restored is used as a proxy for "we're now ready to write `ALERTS/ALERTS_FOR_SERIES` metrics" so as a result we weren't writing the series if we didn't restore anything the first time around.
---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-05-03 14:23:46 +01:00
Kushal shukla d2caf51874
removed formateoverview section (#13994)
docs: Remove outdated information about remote-read API

---------

Signed-off-by: kushagra Shukla <kushalshukla110@gmail.com>
Signed-off-by: Kushal shukla <85934954+kushalShukla-web@users.noreply.github.com>
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
Co-authored-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2024-05-03 09:42:39 -03:00
Augustin Husson 94c81bba41
Merge pull request #14039 from prometheus/resolve-conflicts-2.52
Merge `release-2.52` back to main
2024-05-02 16:47:39 +02:00
Ben Kochie 73f42fea3a
Merge pull request #14023 from prometheus/superq/promu
Update promu
2024-05-02 07:32:12 -07:00
Arthur Silva Sens 650f4d7a72
Merge remote-tracking branch 'origin/main' into resolve-conflicts-2.52 2024-05-02 10:47:45 -03:00
Julien 85e3c438ba
Merge pull request #14029 from prometheus/dependabot/github_actions/actions/upload-artifact-4.3.3
build(deps): bump actions/upload-artifact from 4.3.1 to 4.3.3
2024-05-02 11:15:24 +02:00
Julien 3257ab4285
Merge pull request #14035 from prometheus/dependabot/go_modules/github.com/linode/linodego-1.33.0
build(deps): bump github.com/linode/linodego from 1.32.0 to 1.33.0
2024-05-02 11:14:54 +02:00
Julien 90f45778f8
Merge pull request #14024 from prometheus/dependabot/github_actions/scripts/golangci/golangci-lint-action-5.1.0
build(deps): bump golangci/golangci-lint-action from 4.0.0 to 5.1.0 in /scripts
2024-05-02 11:14:18 +02:00
Julien 2d41a35284
Merge pull request #14027 from prometheus/dependabot/github_actions/actions/checkout-4.1.4
build(deps): bump actions/checkout from 4.1.2 to 4.1.4
2024-05-02 11:13:04 +02:00
Julien ce8789f230
Merge pull request #14031 from prometheus/dependabot/go_modules/documentation/examples/remote_storage/github.com/prometheus/prometheus-0.51.2
build(deps): bump github.com/prometheus/prometheus from 0.51.1 to 0.51.2 in /documentation/examples/remote_storage
2024-05-02 11:12:22 +02:00
Julien cf02e5d7eb
Merge pull request #14037 from prometheus/dependabot/go_modules/google.golang.org/api-0.177.0
build(deps): bump google.golang.org/api from 0.174.0 to 0.177.0
2024-05-02 11:12:02 +02:00
dependabot[bot] bb513b2722
build(deps): bump google.golang.org/api from 0.174.0 to 0.177.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.174.0 to 0.177.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.174.0...v0.177.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:31:24 +00:00
dependabot[bot] 753fdd513a
build(deps): bump github.com/linode/linodego from 1.32.0 to 1.33.0
Bumps [github.com/linode/linodego](https://github.com/linode/linodego) from 1.32.0 to 1.33.0.
- [Release notes](https://github.com/linode/linodego/releases)
- [Commits](https://github.com/linode/linodego/compare/v1.32.0...v1.33.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:31:06 +00:00
dependabot[bot] b90e1dfe6a
build(deps): bump github.com/prometheus/prometheus
Bumps [github.com/prometheus/prometheus](https://github.com/prometheus/prometheus) from 0.51.1 to 0.51.2.
- [Release notes](https://github.com/prometheus/prometheus/releases)
- [Changelog](https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/prometheus/compare/v0.51.1...v0.51.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/prometheus
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:21:27 +00:00
dependabot[bot] 781815f064
build(deps): bump actions/upload-artifact from 4.3.1 to 4.3.3
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.3.1 to 4.3.3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](5d5d22a312...65462800fd)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:05:58 +00:00
dependabot[bot] 1821803720
build(deps): bump actions/checkout from 4.1.2 to 4.1.4
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.2 to 4.1.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9bb56186c3...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:05:44 +00:00
dependabot[bot] ff1bcdb7b9
build(deps): bump golangci/golangci-lint-action in /scripts
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4.0.0 to 5.1.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](3cfe3a4abb...9d1e0624a7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 23:03:44 +00:00
SuperQ f09cf2d9fb
Update promu
Update promu to the latest release.

Signed-off-by: SuperQ <superq@gmail.com>
2024-05-02 00:10:02 +02:00
George Krajcsovits 29b558396a
Merge pull request #14012 from krajorama/ci-check-promql-parser
ci: check generated parser code before running unit tests
2024-05-01 16:35:22 +02:00
Arve Knudsen fc34570b06 prometheusremotewrite: Move TimeSeries method to timeseries.go
To facilitate generating OTel translation code for other Prometheus
compatible backends, modify the prometheusremotewrite sources slightly
so that the PrometheusConverter.TimeSeries method is in a file called
timeseries.go. The rationale is to allow other backends to define their
own implementation of this method.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-05-01 13:02:10 +02:00
Arve Knudsen 12e317786b
Add missing OTLP fixes to changelog (#14014)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2024-04-30 18:44:27 +02:00
György Krajcsovits 965f507db5 ci: check generated parser code before running unit tests
Check that the generated parser code is consistent with the input definition.

Remove the file before re-generating to make sure that missing goyacc is
not effecting the check.

Fixes: #7488

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-04-30 17:58:15 +02:00
gotjosh 1dd0bff4f1
Merge pull request #13980 from prometheus/gotjosh/restore-only-with-rule-query
Rule Manager: Only query once per alert rule when restoring alert state
2024-04-30 15:29:21 +01:00
Arthur Silva Sens f170a014f3
Merge pull request #13969 from prometheus/prepare-v2.52
Prepare v2.52.0-rc.0 release
2024-04-30 09:18:30 -03:00
gotjosh 379dec9d36
querier.Select cannot return a nil series set.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 13:09:30 +01:00
gotjosh 05ca082b07
Rename alerts to expectedAlerts in the test case input
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 12:43:09 +01:00
gotjosh f63dbc3db2
Remove duplicated sorted and assignment of expected alerts.
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 12:39:07 +01:00
Arve Knudsen e491deba97
Merge pull request #14006 from aknuds1/arve/otlp-translator-direct
OTLP: Use PrometheusConverter directly
2024-04-30 13:30:45 +02:00
gotjosh 63b09944b8
Use labels.Len() instead of manually counting the labels
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 12:25:48 +01:00