Commit graph

10112 commits

Author SHA1 Message Date
Julien Pivotto d41e5a5582
Prettifier: Add spaces with non-callable keywords (#11005)
* Prettifier: Add spaces with non-callable keywords

I prefer to have a difference between, on one side: functions calls, end(), start(), and on the other side with, without, ignoring, by and group_rrigt, group_left.

The reasoning is that the former ones are not calls, while other are
functions. Additionally, it matches the examples in our documentation.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>

* Fix tests

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-15 00:09:56 +02:00
Jonathan K. Stevens ce1bf8b15a
template: adding formatTime function to TemplateExpander (#10993)
Signed-off-by: Jonathan Stevens <jonathanstevens89@gmail.com>
Signed-off-by: Jonathan Stevens <jon.stevens@getweave.com>

Co-authored-by: Jonathan Stevens <jon.stevens@getweave.com>
2022-07-14 23:45:32 +02:00
Julien Pivotto 97d7e09e0b
Merge pull request #11022 from prometheus/release-2.37
Merge back release 2.37
2022-07-14 18:30:45 +02:00
Augustin Husson 1ba2bbc5fe
codemirror-promql: fix the way to verify if it's a prometheusClient (#11018)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-07-14 16:28:10 +02:00
Julien Pivotto b41e0750ab
Merge pull request #11020 from roidelapluie/release-2.37.0
Release 2.37.0
2022-07-14 16:24:09 +02:00
Julien Pivotto d0a3d44a45 Release 2.37.0
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-14 16:02:48 +02:00
Julien Pivotto 371b253972 Update prometheus/common for oauth2 improvements
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-14 16:02:48 +02:00
Wen Long 90540c53d8 docs: correct the accepted value for X-XSS-Protection header (#11015)
Signed-off-by: heylongdacoder <heylongdacoder@gmail.com>
2022-07-14 16:02:48 +02:00
Julien Pivotto bfbb061a8f docs: Change relabelling -> relabeling (#11006)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-14 16:02:48 +02:00
Augustin Husson 8228eb4b73
codemirror-promql: fix the way to verify if it's a prometheusClient (#11019)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-07-14 15:22:44 +02:00
Julien Pivotto cf0fdd557e
docs: Change relabelling -> relabeling (#11006)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-14 13:49:30 +02:00
Łukasz Mierzwa 54a3c3ba3f
Print query that caused a panic (#10995)
We print the stacktrace of a panic when query causes one, but there's no
information about the query itself, which makes it harder to debug and
reproduce the issue.
This adds the 'expr' string to the logged panic.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-07-14 15:04:15 +05:30
Wen Long 409a5e7922
docs: correct the accepted value for X-XSS-Protection header (#11015)
Signed-off-by: heylongdacoder <heylongdacoder@gmail.com>
2022-07-14 00:50:02 +02:00
Björn Rabenstein 24ee0c4468
Merge pull request #11016 from prometheus/beorn7/lint
documentation: fix example dependencies
2022-07-13 21:26:30 +02:00
beorn7 20a3990500 documentation: fix example dependencies
The examples were still depending on an ancient prometheus
version. Updating caused some dependency shenanigans, but this should
work for now.

Signed-off-by: beorn7 <beorn@grafana.com>
2022-07-13 20:50:10 +02:00
Björn Rabenstein b06a3222b9
Merge pull request #10908 from raptorsun/queryCapacityAlert
Add Alert PrometheusQueryOverload to mixins
2022-07-13 18:06:56 +02:00
Haoyu Sun 26a7f80aa1 add alert PrometheusHighQueryLoad.
Signed-off-by: Haoyu Sun <hasun@redhat.com>
2022-07-13 14:08:24 +02:00
Oleg Zaytsev d2abe9a58a
Shortcut ContainsSameLabelset() (#11000)
* Shortcut Matrix.ContainsSameLabelset()

It's quite often to execute this check on a Matrix that has zero or only
one series. There's no need to allocate a map for those cases.

There's also a one-liner for two-series case, so why not using it?

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Add license header

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Optimize Vector.ContainsSameLabelset

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2022-07-13 15:18:10 +05:30
Jaseel f8c3b0bd1c
Corrected custom prometheus client docs (#11010)
Signed-off-by: Jaseel <12792882+Spikatrix@users.noreply.github.com>
2022-07-13 10:51:51 +02:00
Julien Pivotto 3599213e79
Release 2.37.0-rc.1 (#10999)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-11 10:04:30 +02:00
Harkishen Singh 44fcf876ca
Adds support for prettifying PromQL expression (#10544)
* Implement Pretty() function for AST nodes.

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

This commit adds .Pretty() for all nodes of PromQL AST.
Each .Pretty() prettifies the node it belongs to, and under
no circustance, the parent or child node is touch/prettified.

Read more in the "Approach" part in `prettier.go`

* Refactor functions between printer.go & prettier.go

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

This commit removes redundancy between printer.go and prettier.go
by taking out the common code into separate private functions.

* Add more unit tests for Prettier.

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* Add support for spliting function calls with 1 arg & unary expressions.

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

This commit does 2 things:
1. It adds support to split function calls that have 1 arg and exceeds the max_characters_per_line
to multiple lines.
2. Splits Unary expressions that exceed the max_characters_per_line. This is done by formatting the child node
and then removing the prefix indent, which is already applied before the unary operator.
2022-07-07 18:13:36 +05:30
Julien Pivotto 7a2d24b76a
Fix flakiness in windows tests (#10983)
Our windows CI is too slow, process takes lots of time to start.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-06 10:33:14 +02:00
Augustin Husson 6af2f9ff5e
add missing npm registry url (#10987)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-07-05 16:38:16 +02:00
Julien Pivotto 27559e7b4f
Merge pull request #10985 from prometheus/release-2.37
Merge back release 2.37
2022-07-05 16:05:30 +02:00
Julien Pivotto 2479fb42f0
Improve notifier queue test to reduce flakiness (#10984)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-05 15:27:26 +02:00
Richard Hartmann 7bb6e7dadd
Merge pull request #10707 from hdost/docs/2106-vector-matching
docs: Add subsections for vector matching
2022-07-05 15:24:47 +02:00
Julien Pivotto 7479cd95b0
Fix UI release script and bump UI release (#10981)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-05 15:12:59 +02:00
Julien Pivotto 335562dbfe
Cut v2.37.0-rc.0 (#10971)
* Cut v2.37.0-rc.0

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-05 13:10:55 +02:00
dependabot[bot] f389711943
build(deps): bump github.com/aws/aws-sdk-go from 1.44.45 to 1.44.47 (#10960)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.44.45 to 1.44.47.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.44.45...v1.44.47)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  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>
2022-07-05 09:49:52 +02:00
dependabot[bot] 26117fc885
build(deps): bump bufbuild/buf-setup-action from 1.5.0 to 1.6.0 (#10958)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  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>
2022-07-04 10:59:51 +02:00
Matthieu MOREL d56d0a9d52
(storage): move from github.com/pkg/errors to 'errors' and 'fmt' (#10946)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-07-01 18:59:50 +02:00
Julien Pivotto 13bd4fd3c8
Fix promtool check config not erroring properly on failures (#10952)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-01 14:38:49 +02:00
Julien Pivotto 90583c8906
TestScrapeLoopCache: Display content of the appender (#10937)
This should help identifying windows tests flakiness.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-01 14:28:56 +02:00
Julien Pivotto 02f3297719
Split notifier select in 2 to ensure newer targets are used. (#10948)
* Split notifier select in 2 to ensure newer targets are used.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-07-01 14:23:23 +02:00
Julien Pivotto 4aa693da99
Update go dependencies (#10938)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-30 22:10:19 +02:00
Leonardo Zamariola 3326df42bb
Removing global state modification on unit tests (fix #10033 #10034) (#10935)
* Removing global state modification on unit tests (fix #10033 #10034)

The config.DefaultRemoteReadConfig and config.DefaultRemoteWriteConfig
instances hold global state. Unit tests were changing their url.URL reference
globally causing false positives when tests were ran through package.
Two helper functions were created to copy those global values instead of changing
them in place to fix null point when running unit tests by method instead of
by package.

Signed-off-by: Leonardo Zamariola <leonardo.zamariola@gmail.com>

* Fixing pull request suggestions

Copying by value from default config

Signed-off-by: Leonardo Zamariola <leonardo.zamariola@gmail.com>
2022-06-30 10:20:16 -06:00
Julien Pivotto 875c4aa12e
Merge pull request #10915 from attachmentgenie/nomad_sd
feat(nomad): add nomad service discovery
2022-06-30 15:26:20 +02:00
Jesus Vazquez 6cfe44d7fd
WaitUntilIdle optimize idling time (#10878)
Relates to @bboreham optimization in https://github.com/prometheus/prometheus/pull/10859

Bryan did reduce the sleep time improving the deltas on the benchmark by
quite a lot. However I've been working on a similar implementation for
out of order and I noticed that we actually get into this method
thousands of times.

@ywwg had the brilliant idea of not always sleeping before the select
but actually make it a case in the select so we only sleep if we need
to.

The benchmark deltas are amazing

```
❯ benchstat old_implementation.txt new_implementation_using_time_after.txt
name                                                                                                     old time/op  new time/op  delta
LoadWAL/batches=10,seriesPerBatch=100,samplesPerSeries=7200,exemplarsPerSeries=0,mmappedChunkT=0-8        521ms ±25%   253ms ± 6%  -51.47%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=100,samplesPerSeries=7200,exemplarsPerSeries=36,mmappedChunkT=0-8       773ms ± 3%   369ms ±31%  -52.23%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=100,samplesPerSeries=7200,exemplarsPerSeries=72,mmappedChunkT=0-8       592ms ±28%   297ms ±28%  -49.80%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=100,samplesPerSeries=7200,exemplarsPerSeries=360,mmappedChunkT=0-8      547ms ± 2%  999ms ±187%     ~     (p=0.690 n=5+5)
LoadWAL/batches=10,seriesPerBatch=10000,samplesPerSeries=50,exemplarsPerSeries=0,mmappedChunkT=0-8        11.3s ± 4%    1.3s ±44%  -88.48%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=10000,samplesPerSeries=50,exemplarsPerSeries=2,mmappedChunkT=0-8        11.1s ± 1%    1.2s ±20%  -89.08%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=0,mmappedChunkT=0-8        1.24s ± 3%   0.18s ± 7%  -85.76%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=2,mmappedChunkT=0-8        1.24s ± 2%   0.18s ± 5%  -85.24%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=5,mmappedChunkT=0-8        1.23s ± 5%   0.27s ±33%  -77.73%  (p=0.008 n=5+5)
LoadWAL/batches=10,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=24,mmappedChunkT=0-8       1.28s ± 1%   0.36s ± 7%  -71.51%  (p=0.008 n=5+5)
LoadWAL/batches=100,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=0,mmappedChunkT=3800-8    12.1s ± 1%    3.1s ± 6%  -74.33%  (p=0.008 n=5+5)
LoadWAL/batches=100,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=2,mmappedChunkT=3800-8    12.1s ± 1%    3.4s ± 4%  -71.94%  (p=0.008 n=5+5)
LoadWAL/batches=100,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=5,mmappedChunkT=3800-8    12.1s ± 1%    3.8s ±17%  -68.35%  (p=0.008 n=5+5)
LoadWAL/batches=100,seriesPerBatch=1000,samplesPerSeries=480,exemplarsPerSeries=24,mmappedChunkT=3800-8   12.4s ± 1%    4.0s ±18%  -67.71%  (p=0.008 n=5+5)
```

Benchmarked on Linux
```
goos: linux
goarch: amd64
pkg: github.com/prometheus/prometheus/tsdb
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
```

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
2022-06-30 15:00:04 +02:00
renzheng.wang db2614102f
add description for __meta_kubernetes_endpoints_label_* and __meta_kubernetes_endpoints_labelpresent_* (#10911)
* add description for __meta_kubernetes_endpoints_label_* and __meta_kubernetes_endpoints_labelpresent_*

Signed-off-by: renzheng.wang <wangrzneu@gmail.com>
2022-06-30 18:22:53 +05:30
Julien Pivotto 466f053a6e nomad: Use failuresCount counter
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-30 14:19:58 +02:00
Julien Pivotto d9347bf128 nomad: Fix documentation and comments.
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-30 14:19:55 +02:00
Bram Vogelaar 4456dcc26e feat(nomad): add nomad service discovery
Signed-off-by: Bram Vogelaar <bram@attachmentgenie.com>
2022-06-30 14:17:08 +02:00
Augustin Husson 7b006e804c
enable ui module publication (#10876)
* enable ui module publication

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* use main changelog of Prometheus to reflect the changes of the packages

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* ignore changelog and license in the libs

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* replace perses references

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-30 12:10:10 +02:00
A. Gavin 8f16cc99ec
docs: clarify supported tls cipher suites (#10903)
Signed-off-by: Alex Gavin <a_gavin@icloud.com>
2022-06-30 11:34:49 +02:00
Julien Pivotto c637705403
Merge pull request #10893 from prymitive/unwrap_errors
Implement Unwrap() on errors returned from rulefmt
2022-06-30 11:30:21 +02:00
Julien Pivotto bacd776356
Merge pull request #10907 from damnever/fix/panic
Fix panic if series is not found when deleting series
2022-06-30 11:23:08 +02:00
Peter Štibraný ffc60d8397
Reduce chunk write queue memory usage 2 (#10874)
* Job queue

This PR reimplements chan chunkWriteJob with custom buffered queue that should use less memory, because it doesn't preallocate entire buffer for maximum queue size at once. Instead it allocates individual "segments" with smaller size.

As elements are added to the queue, they fill individual segments. When elements are removed from the queue (and segments), empty segments can be thrown away. This doesn't change memory usage of the queue when it's full, but should decrease its memory footprint when it's empty (queue will keep max 1 segment in such case).

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>

* Modify test to work with low resolution timer.

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>

* Improve comments.

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
2022-06-29 17:51:27 +05:30
Julien Pivotto b93ce29674
Merge pull request #10927 from prometheus/release-2.36
Merge Release 2.36
2022-06-28 21:29:01 +02:00
Xiaonan Shen 0c3abdc26d
Keep relabeled scrape interval and timeout on reloads (#10916)
* Preserve relabeled scrape interval and timeout on reloads

Signed-off-by: Xiaonan Shen <s@sxn.dev>
2022-06-28 11:58:52 +02:00
Matthieu MOREL c2b4de3611
refactor (package model): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10747)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
Co-Authored-By: Julien Pivotto <roidelapluie@gmail.com>

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
2022-06-27 21:29:19 +02:00