Commit graph

11188 commits

Author SHA1 Message Date
Julien Pivotto 41b3db198c
Merge pull request #12367 from AkshaySiwal/main
Updating signal for graceful shutdown in docs/getting_started.md
2023-05-16 22:25:26 +02:00
zenador 191bf9055b
Handle more arithmetic operators for native histograms (#12262)
Handle more arithmetic operators and aggregators for native histograms

This includes operators for multiplication (formerly known as scaling), division, and subtraction. Plus aggregations for average and the avg_over_time function.

Stdvar and stddev will (for now) ignore histograms properly (rather than counting them but adding a 0 for them).

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-05-16 21:15:20 +02:00
Björn Rabenstein 30e263cf96
Merge pull request #12357 from krajorama/fix-histogram-appendable-emptybucket
fix HistogramAppender.appendable segfault
2023-05-16 20:52:39 +02:00
Bryan Boreham a073e04a9b
Merge pull request #12366 from prometheus/release-2.44
Merge release 2.44 back to main
2023-05-16 18:06:29 +01:00
Callum Styan 0d2108ad79
[tsdb] re-implement WAL watcher to read via a "notification" channel (#11949)
* WIP implement WAL watcher reading via notifications over a channel from
the TSDB code

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Notify via head appenders Commit (finished all WAL logging) rather than
on each WAL Log call

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Fix misspelled Notify plus add a metric for dropped Write notifications

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Update tests to handle new notification pattern

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* this test maybe needs more time on windows?

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* does this test need more time on windows as well?

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* read timeout is already a time.Duration

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* remove mistakenly commited benchmark data files

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* address some review feedback

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* fix missed changes from previous commit

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* Fix issues from wrapper function

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* try fixing race condition in test by allowing tests to overwrite the
read ticker timeout instead of calling the Notify function

Signed-off-by: Callum Styan <callumstyan@gmail.com>

* fix linting

Signed-off-by: Callum Styan <callumstyan@gmail.com>

---------

Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-05-15 12:31:49 -07:00
Akshay Siwal 4c898fc4a1
Update getting_started.md
Updating signal for graceful shutdown.

Signed-off-by: Akshay Siwal <akshay.singh.siwal@gmail.com>
2023-05-15 13:18:30 +05:30
György Krajcsovits c6618729c9 Fix HistogramAppender.Appendable array out of bound error
The code did not handle spans with 0 length properly.

Spans with length zero are now skipped in the comparison.
Span index check not done against length-1, since length is a unit32,
thus subtracting 1 leads to 2^32, not -1.

Fixes and unit tests for both integer and float histograms added.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-05-14 17:38:52 +02:00
Bryan Boreham 1ac5131f69
Release 2.44.0 (#12364)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-14 07:13:03 +01:00
Björn Rabenstein b727e69b76
Merge pull request #12350 from prometheus/beorn7/histogram
textparse/scrape: Add option to scrape both classic and native histograms
2023-05-13 02:16:11 +02:00
beorn7 9e500345f3 textparse/scrape: Add option to scrape both classic and native histograms
So far, if a target exposes a histogram with both classic and native
buckets, a native-histogram enabled Prometheus would ignore the
classic buckets. With the new scrape config option
`scrape_classic_histograms` set, both buckets will be ingested,
creating all the series of a classic histogram in parallel to the
native histogram series. For example, a histogram `foo` would create a
native histogram series `foo` and classic series called `foo_sum`,
`foo_count`, and `foo_bucket`.

This feature can be used in a migration strategy from classic to
native histograms, where it is desired to have a transition period
during which both native and classic histograms are present.

Note that two bugs in classic histogram parsing were found and fixed
as a byproduct of testing the new feature:

1. Series created from classic _gauge_ histograms didn't get the
   _sum/_count/_bucket prefix set.
2. Values of classic _float_ histograms weren't parsed properly.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-05-13 01:32:25 +02:00
Frederic Branczyk 5c5fa5c319
Merge pull request #12338 from mickael-carl/mcarl/attach-node-labels
discovery/kubernetes: attach node labels when the endpoints TargetRef's kind are Node
2023-05-11 12:03:27 +02:00
Jesus Vazquez 1f1dac2cda
Merge pull request #12351 from alanprot/optimization/MatchNotRegexp
Implementing Regex optimization on the `MatchNotRegexp` matcher type
2023-05-11 11:55:17 +02:00
Bryan Boreham fa4f4e4f37
Merge pull request #12349 from rfratto/fix-wlog-path
wlog: use filepath for getting checkpoint number

'path' is intended for things like URLs that are forward-slash-only.
'filepath' is for file paths, as used here.
2023-05-11 10:43:47 +01:00
Mickael Carl 2f35619710 discovery/kubernetes: attach node labels when the endpoints TargetRef's kind are Node
Signed-off-by: Mickael Carl <mcarl@apple.com>
2023-05-11 10:11:56 +01:00
Alan Protasio c0f1abb574 MatchNotRegexp optimization
Signed-off-by: Alan Protasio <alanprot@gmail.com>
2023-05-10 20:08:38 -07:00
Bryan Boreham 734baa37e0
Merge pull request #12344 from bboreham/rw-stable
docs: state that remote write sending is stable
2023-05-10 18:56:16 +01:00
Robert Fratto 9e4e2a4a51
wlog: use filepath for getting checkpoint number
This changes usage of path to be replaced with path/filepath, allowing
for filepath.Base to properly return the base directory on systems where
`/` is not the standard path separator.

This resolves an issue on Windows where intermediate folders containing
a `.` were incorrectly considered to be a part of the checkpoint name.

Related to grafana/agent#3826.

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2023-05-10 12:38:02 -04:00
Björn Rabenstein bd98fc8c45
Merge pull request #12254 from zenador/histogram-bucket-limit
Implement bucket limit for native histograms
2023-05-10 17:42:29 +02:00
Björn Rabenstein 37fe9b89dc
Merge pull request #12055 from leizor/leizor/prometheus/issues/12009
Adjust samplesPerChunk from 120 to 220
2023-05-10 14:45:12 +02:00
Ganesh Vernekar 3c4802635d
Merge pull request #12345 from codesome/codeowners
Remove codesome and add jesusvazquez in CODEOWNERS for tsdb
2023-05-09 20:21:29 +05:30
Ganesh Vernekar a96350f15f
Remove codesome and add jesusvazquez in CODEOWNERS for tsdb
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2023-05-09 19:30:18 +05:30
Bryan Boreham b1b8fd77c4 docs: state that remote write is stable
Since https://github.com/prometheus/docs/pull/2313 has been merged
declaring remote write to be stable at version 1.0.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-09 10:29:52 +00:00
Bryan Boreham 94d9367bbf
Create 2.44.0-rc.2 (#12341)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-08 11:30:29 +01:00
Björn Rabenstein d61811ef32
Merge pull request #12326 from prometheus/beorn7/storage
storage: optimise sampleRing
2023-05-05 21:25:23 +02:00
George Krajcsovits f5fcaa3872
Fix setting reset header to gauge histogram in seriesToChunkEncoder (#12329)
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-05-05 18:04:30 +05:30
Jeanette Tan 40240c9c1c Update according to code review
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-05-05 02:33:00 +08:00
György Krajcsovits 19a4f314f5 Refactor testutil/protobuf.go into scrape package
Renamed to clientprotobuf.go and added comments to indicate the
intended usage.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-05-04 08:36:44 +02:00
György Krajcsovits e9b2d87443 Revert change to model/textparse/protobufparse_test.go
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-05-04 08:16:37 +02:00
Björn Rabenstein 7c2de14b0b
Merge pull request #12243 from leizor/leizor/prometheus/issues/11274
Optimize and test MemoizedSeriesIterator
2023-05-03 23:51:44 +02:00
Justin Lei 7bbf24b707 Make MemoizedSeriesIterator not implement chunkenc.Iterator
Signed-off-by: Justin Lei <justin.lei@grafana.com>
2023-05-03 12:45:39 -07:00
beorn7 b0272255b7 storage: optimise sampleRing
Replace many checks for the lengths of slices with a single tracking
variable.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-05-03 20:09:29 +02:00
Bryan Boreham 3d26faade4
Create 2.44.0-rc.1 (#12323)
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-03 16:18:28 +01:00
Bryan Boreham 7a48a266b6
labels: respect Set after Del in Builder (#12322)
* labels: respect Set after Del in Builder

The implementations are not symmetric between `Set()` and `Del()`, so
we must be careful. Add tests for this, both in labels and in relabel
where the issue was reported.

Also make the slice implementation consistent re `slices.Contains`.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-03 11:59:27 +01:00
Justin Lei 6985dcbe73 Optimize and test MemoizedSeriesIterator
Signed-off-by: Justin Lei <justin.lei@grafana.com>
2023-05-02 08:53:18 -07:00
Bryan Boreham 0ab9553611
tsdb: drop deleted series from the WAL sooner (#12297)
`head.deleted` holds the WAL segment in use at the time each series was
removed from the head. At the end of `truncateWAL()` we will delete
all segments up to `last`, so we can drop any series that were last seen
in a segment at or before that point.

(same change in Prometheus Agent too)

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-05-01 16:43:15 +01:00
Filip Petkovski 0d049feac7
Fix encoding samples in ChunkSeries (#12185)
The storage.ChunkSeries iterator assumes that a histogram sample can always be
appended to the currently open chunk. This is not the case when there is a counter reset,
or when appending a stale sample to a chunk with non-stale samples. In addition, the open chunk sometimes
needs to be recoded before a sample can be appended.

This commit addresses the issue by implementing a RecodingAppender which can recode incoming
samples in a transparent way. It also detects cases when a sample cannot be appended at all and
returns `false` so that the caller can open a new chunk.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2023-04-28 16:52:21 -04:00
Julien Pivotto 24d7e5bd49
Merge pull request #12296 from rsc/loopvar
scrape: fix two loop variable scoping bugs in test
2023-04-27 11:24:04 +02:00
Julien Pivotto 3c3ea24929
Merge pull request #12290 from cuishuang/main
Fix some comments.
2023-04-27 11:16:05 +02:00
Russ Cox 28f5502828 scrape: fix two loop variable scoping bugs in test
Consider code like:

	for i := 0; i < numTargets; i++ {
		stopFuncs = append(stopFuncs, func() {
			time.Sleep(i*20*time.Millisecond)
		})
	}

Because the loop variable i is shared by all closures,
all the stopFuncs sleep for numTargets*20 ms.

If the i were made per-iteration, as we are considering
for a future Go release, the stopFuncs would have sleep
durations ranging from 0 to (numTargets-1)*20 ms.

Two tests had code like this and were checking that the
aggregate sleep was at least numTargets*20 ms
("at least as long as the last target slept"). This is only true
today because i == numTarget during all the sleeps.

To keep the code working even if the semantics of this loop
change, this PR computes

	d := time.Duration((i+1)*20) * time.Millisecond

outside the closure (but inside the loop body), and then each
closure has its own d. Now the sleeps range from 20 ms
to numTargets*20 ms, keeping the test passing
(and probably behaving closer to the intent of the test author).

The failure being fixed can be reproduced by using the current
Go development branch with

	GOEXPERIMENT=loopvar go test

Signed-off-by: Russ Cox <rsc@golang.org>
2023-04-26 10:33:10 -04:00
Julien Pivotto d4bf47766e
Merge pull request #12292 from tpaschalis/fix-recommended-protoc
Fix recommended protoc version
2023-04-26 14:38:32 +02:00
Paschalis Tsilias 8a34c43515
Update prompb/README.md
Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
Signed-off-by: Paschalis Tsilias <tpaschalis@users.noreply.github.com>
2023-04-26 12:57:20 +03:00
Paschalis Tsilias 55626c6911 Fix final newline
Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
2023-04-26 12:44:15 +03:00
Paschalis Tsilias 93f64754c0 Remove extra line
Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
2023-04-26 12:43:19 +03:00
Bryan Boreham d70688038e
Merge pull request #12289 from bboreham/release-2.44-rc0
Create new Release Candidate 2.44.0-rc0
2023-04-26 10:39:34 +01:00
Jesus Vazquez 0bf707e288
Merge pull request #12293 from jesusvazquez/jvp/propose-jesus-vazquez-as-2-45-release-shepherd
Propose Jesus Vazquez as 2.45 release shepherd
2023-04-25 21:02:30 +02:00
Jesus Vazquez 38de61b59b Propose Jesus Vazquez as 2.45 release shepherd
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
2023-04-25 17:59:00 +02:00
Paschalis Tsilias 417e847662
Update prompb/README.md
Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
Signed-off-by: Paschalis Tsilias <tpaschalis@users.noreply.github.com>
2023-04-25 17:17:22 +03:00
Paschalis Tsilias c06c02b3b1 Fix recommended protoc version
Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
2023-04-25 16:27:39 +03:00
Bryan Boreham 6b25e9a923 build: turn on stringlabels by default
This setting uses less memory, and was optional in previous release 2.43.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-04-25 10:11:32 +00:00
Bryan Boreham 8bfd162198 Review feedback - mostly capitalization
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-04-25 10:06:23 +00:00