Commit graph

10375 commits

Author SHA1 Message Date
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
beorn7 9eafed0f79 promql: Add histogram_count and histogram_sum
This follow a simple function-based approach to access the count and
sum fields of a native Histogram. It might be more elegant to
implement “accessors” via the dot operator, as considered in the
brainstorming doc [1]. However, that would require the introduction of
a whole new concept in PromQL. For the PoC, we should be fine with the
function-based approch. Even the obvious inefficiencies (rate'ing a
whole histogram twice when we only want to rate each the count and the
sum once) could be optimized behind the scenes.

Note that the function-based approach elegantly solves the problem of
detecting counter resets in the sum of observations in the case of
negative observations. (Since the whole native Histogram is rate'd,
the counter reset is detected for the Histogram as a whole.)

We will decide later if an “accessor” approach is really needed. It
would change the example expression for average duration in
functions.md from

      histogram_sum(rate(http_request_duration_seconds[10m]))
	/
      histogram_count(rate(http_request_duration_seconds[10m]))

to

      rate(http_request_duration_seconds.sum[10m])
	/
      rate(http_request_duration_seconds.count[10m])

[1]: https://docs.google.com/document/d/1ch6ru8GKg03N02jRjYriurt-CZqUVY09evPg6yKTA1s/edit

Signed-off-by: beorn7 <beorn@grafana.com>
2022-06-28 18:16:48 +02:00
Björn Rabenstein f9f2e2855d
Merge pull request #10886 from prometheus/beorn7/sparsehistogram
Add histogram_fraction function
2022-06-28 16:34:13 +02:00
beorn7 a3a8f58bb3 promql: Add histogram_fraction function
Signed-off-by: beorn7 <beorn@grafana.com>
2022-06-28 15:58:03 +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
Matthieu MOREL 6375417324
refactor (util): move from github.com/pkg/errors to 'errors' and 'fmt' (#10877)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-06-27 18:16:58 +02:00
lixin18 735a07444a
Update main_unix_test.go (#10917)
so->,so

Signed-off-by: lixin18 <68135097+lixin963@users.noreply.github.com>
2022-06-27 16:15:51 +02:00
Xiaochao Dong (@damnever) 6b042da2d8 Fix panic if series is not found when deleting series
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
2022-06-24 15:55:32 +08:00
Augustin Husson 87ffac3e9d
Add readme for lezer-promql and update codemirror-promql readme (#10875)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-22 16:57:03 +02:00
Steve Azzopardi 04fe2c9522
fix(tsdb): inc mmap corruption counter on mmap out of sequence error (#10406)
What
---
When we see out of sequence chunks increase the chunk corruption counter
to indicate that one of the chunks was corrupted.

Reference: https://github.com/prometheus/prometheus/pull/10406#issuecomment-1142595527
Signed-off-by: Steve Azzopardi <steveazz@outlook.com>
2022-06-22 14:03:12 +05:30
Łukasz Mierzwa 648b12d8c5 Implement Unwrap() on errors returned from rulefmt
I'd like to unwrap errors returned from rulefmt but both Error and WrappedError types are missing Unwrap() method.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-06-20 17:01:52 +01:00
Matthias Loibl d7e7b8e04b
Merge pull request #10891 from metalmatze/release-2.36.2
Add v2.36.2 CHANGELOG and VERSION update
2022-06-20 14:54:40 +02:00
Matthias Loibl ee9d85bd6c
Add v2.36.2 CHANGELOG and VERSION update
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2022-06-20 14:34:03 +02:00
Julien Pivotto c511d26dd0
Upgrade Prometheus/common to fix static assets (#10889)
Properly fix #10697

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-20 08:59:56 +00:00
Matthias Loibl 17d42f015b
Merge pull request #10888 from roidelapluie/properfix
Upgrade Prometheus/common to fix static assets
2022-06-20 10:53:55 +02:00
Julien Pivotto 94e60eddbe Upgrade Prometheus/common to fix static assets
Properly fix #10697

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-20 10:32:40 +02:00
beorn7 ffaabea91a promql: Refine zero bucket treatment in histogramQuantile
Essentially, this mirrors the existing behavior for negative buckets:
If a histogram has only negative buckets, the upper bound of the zero
bucket is assumed to be zero.

Furthermore, it makes sure that the zero bucket boundaries are not
modified if a histogram that has no buckets at all but samples in the
zero bucket.

Also, add an TODO to vet if we really want this behavior.

Signed-off-by: beorn7 <beorn@grafana.com>
2022-06-19 15:06:51 +02:00
Julien Pivotto a0aec2db82
Fix handling of static files (#10879)
Closes #10697

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-18 14:26:06 +02:00
Matthias Loibl 9f1a3970b2
Merge pull request #10880 from roidelapluie/mimetrel
UI: Fix handling of static files by upgrading common/assets
2022-06-17 17:31:02 +02:00
Julien Pivotto 564cee9116 UI: Fix handling of static files by upgrading common/assets
Adds more mime types.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-17 16:52:23 +02:00
Matthew ee11771323
fix: add response closures to web_test.go (#10675)
* fix: add response closures to web_test.go

Signed-off-by: mtfoley <mtfoley.mae@gmail.com>
2022-06-17 09:55:52 +02:00
Matthieu MOREL ddfa9a7cc5
refactor (rules): move from github.com/pkg/errors to 'errors' and 'fmt' (#10855)
* refactor (rules): move from github.com/pkg/errors to 'errors' and 'fmt'

Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-06-17 09:54:25 +02:00
Peter Štibraný 03a2313f7a
Reduce chunk write queue memory usage (#10873)
* dont waste space on the chunkRefMap
* add time factor
* add comments
* better readability
* add instrumentation and more comments
* formatting
* uppercase comments
* Address review feedback. Renamed "free" to "shrink" everywhere, updated comments and threshold to 1000.
* double space

Signed-off-by: Mauro Stettler <mauro.stettler@gmail.com>
Co-authored-by: Peter Štibraný <pstibrany@gmail.com>

Co-authored-by: Mauro Stettler <mauro.stettler@gmail.com>
2022-06-17 13:11:39 +05:30
Bryan Boreham 9f77d23889
tsdb: commit data periodically in CreateBlock (#10788)
To avoid building up data in memory, commit and make a new appender
periodically.

The number `commitAfter = 10000` was chosen arbitrarily; testing with
10x more or less gives slightly worse results.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-06-17 11:26:19 +05:30
Łukasz Mierzwa d65f037def
Don't increment prometheus_tsdb_compactions_failed_total when context is canceled (#10772)
When restarting Prometheus I sometimes see:

caller=db.go:832 level=error component=tsdb msg="compaction failed" err="compact head: persist head block: 2 errors: populate block: context canceled; context canceled"

And prometheus_tsdb_compactions_failed_total metric gets incremented.
This makes it more difficult to write alerts based on
prometheus_tsdb_compactions_failed_total metric since any restart can
trigger it.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-06-17 11:21:43 +05:30
Frederic Branczyk 0d0e44d7e6
Merge pull request #10759 from fpetkovski/endpoints-node-meta
kubernetes_sd: Allow attaching node labels for endpoint role
2022-06-16 17:09:32 +02:00
Filip Petkovski 05da373dcb
kubernetes_sd: Allow attaching node labels for endpoint role
The Kubernetes service discovery can only add node labels to
targets from the pod role.

This commit extends this functionality to the endpoints and
endpointslices roles.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2022-06-16 12:22:55 +02:00
Matthieu MOREL 80fbe1de96
refactor (package model): move from github.com/pkg/errors to 'errors' and 'fmt' packages (#10748)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-06-16 10:38:27 +02:00
David Leadbeater 454714105d
Drop OpenBSD from promu config (#10867)
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-06-16 10:36:28 +02:00
beorn7 095b6c93dd Merge branch 'main' into sparsehistogram 2022-06-14 14:27:35 +02:00
Björn Rabenstein 77d591cbce
Merge pull request #10851 from prometheus/beorn7/sparsehistogram
Merge main into sparsehistogram
2022-06-14 14:16:42 +02:00
beorn7 fb92a801f6 prompb: add lint ignores for metrics.proto
Signed-off-by: beorn7 <beorn@grafana.com>
2022-06-14 13:47:09 +02:00
Levi Harrison 59727ab0eb
Make clear that go install needs to be run in the cloned repo (#10866)
* `go install` in cloned repo

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Removing cloning to gopath

Signed-off-by: Levi Harrison <git@leviharrison.dev>

* Change wording

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2022-06-13 22:00:27 +02:00
Sebastian Poxhofer 3f9a9d1e62
chore(discoveryManager): expose Discoverer refresh function (#10531)
Signed-off-by: secustor <sebastian@poxhofer.at>
2022-06-13 21:06:15 +02:00
Augustin Husson 5d1756c822
Upgrade codemirror and lezer to the latest version (#10841)
* bump codemirror to v0.20.x and lezer to v.0.16.x

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

* bump codemirror to v6 and lezer to v1

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

* stop treating warning as error for UI

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 17:55:06 +02:00
Peter Štibraný 5bd761fbfc
Merge pull request #10857 from pstibrany/fix-errors-handling
API: Fix errors handling
2022-06-13 17:45:35 +02:00
Augustin Husson 3dad28fcbd
UI: fix build (#10862)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 16:40:08 +02:00
Augustin Husson 5184f49a2a
put every packages under the prometheus-io organization (#10849)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 15:19:07 +02:00
Paschalis Tsilias 4f3791024a
Drop extra string held in relabel.Regexp struct (#10846)
* Drop extra string held in relabel.Regexp struct

Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>

* Use slice operations instead of TrimPrefix/TrimSuffix; Override String() method

Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
2022-06-13 15:00:48 +02:00
Julien Pivotto 229e857416
Merge pull request #10795 from prometheus/dependabot/go_modules/k8s.io/client-go-0.24.1
build(deps): bump k8s.io/client-go from 0.24.0 to 0.24.1
2022-06-13 13:56:34 +02:00
Augustin Husson f609b7bbcc
remove GO111MODULE and GOVENDOR usage (#10836)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 13:08:59 +02:00
dependabot[bot] f4ea0709f9
build(deps): bump k8s.io/client-go from 0.24.0 to 0.24.1
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.24.0 to 0.24.1.
- [Release notes](https://github.com/kubernetes/client-go/releases)
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.24.0...v0.24.1)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 09:42:48 +00:00
Julien Pivotto eb07db104a
Merge pull request #10835 from prometheus/dependabot/go_modules/github.com/stretchr/testify-1.7.2
build(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2
2022-06-13 11:40:42 +02:00
Augustin Husson e166cf402a
use npm workspace flag for the build instead of manually navigate through the folders (#10854)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 10:53:46 +02:00
Bryan Boreham 542b9ecdbd
tsdb: reduce sleep time when reading WAL (#10859)
The code sleeps for a short time to allow goroutines to finish, however
it seems the duration can be reduced a lot, speeding up the reading
process.

I checked using some WAL data from production, and the queue is almost
always empty at the time we enter `waitForIdle()` so there is no danger
of spinning in the tight loop.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-06-12 11:54:11 +05:30
beorn7 40ad5e284a Merge branch 'main' into beorn7/sparsehistogram 2022-06-09 20:50:30 +02:00
Julien Pivotto a84c472745
Merge back release-2.36 (#10850)
* Fix UI build (#10842)

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

* Add --lint-fatal option (#10815) (#10840)

This keeps the previous behaviour of printing details about duplicate
rules but doesn't exit with a fatal exit code unless turned on.

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

Co-authored-by: David Leadbeater <dgl@dgl.cx>

* Add v2.36.1 CHANGELOG and VERSION update

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu>
Co-authored-by: David Leadbeater <dgl@dgl.cx>
2022-06-09 18:09:44 +02:00
dependabot[bot] 00982ce4d3
build(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.1...v1.7.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-09 14:37:17 +00:00