Commit graph

11162 commits

Author SHA1 Message Date
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
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
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
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
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
cui fliter 276ca6a883 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-25 14:19:16 +08:00
Jeanette Tan dfabc69303 Add tests according to code review
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-25 02:07:36 +08:00
Bryan Boreham cf1bea344a
Merge pull request #12191 from narqo/web-gomemlimit
Display GOMEMLIMIT in runtime info
2023-04-24 13:13:06 +02:00
Vladimir Varankin d281ebb178 web: display GOMEMLIMIT in runtime info
Signed-off-by: Vladimir Varankin <vladimir@varank.in>
2023-04-23 20:24:34 +02:00
Julien Pivotto 7cd9f8a340
Merge pull request #12285 from bboreham/update-older-go
Update test_golang_oldest to 1.19
2023-04-22 15:55:59 +02:00
Bryan Boreham 13938d0ccc Update test_golang_oldest to 1.19
Since test_go is on 1.20, and it should use the previous version.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-04-22 10:16:49 +02:00
Björn Rabenstein d52a976ee1
Merge pull request #12272 from zenador/check-histogram-type-on-convert
Perform integer/float histogram type checking on conversions
2023-04-21 21:52:00 +02:00
Jeanette Tan 2ad39baa72 Treat bucket limit like sample limit and make it fail the whole scrape and return an error
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-22 03:25:07 +08:00
György Krajcsovits 071426f72f Add unit test for bucket limit appender
Refactors textparser test to use a common test utility to create
protobuf representation from MetricFamily

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-04-22 03:14:19 +08:00
Jeanette Tan d3ad158a66 Update docs and comments
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-22 03:14:19 +08:00
Jeanette Tan 4d21ac23e6 Implement bucket limit for native histograms
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-22 03:14:19 +08:00
Jeanette Tan 1102ffd188 Fix according to code review
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-22 02:27:15 +08:00
Jeanette Tan e9a1e26ab7 Perform integer/float histogram type checking on conversions, and use a consistent method for determining integer vs float histogram
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-04-22 02:27:15 +08:00
Julien Pivotto 8f1dc4a70f
Merge pull request #12248 from yeya24/consistent-response
Use same error for instant and range query when 400
2023-04-21 11:44:20 +02:00
Julien Pivotto 0b212fd123
Merge pull request #12279 from mmorel-35/linters
golangci-lint: remove skip-cache and restore singleCaseSwitch rule
2023-04-20 19:18:07 +02:00
Julien Pivotto 388eb03923
Merge pull request #12277 from roidelapluie/restore-main
Revert type casting removal
2023-04-20 19:17:32 +02:00
Matthieu MOREL 7e9acc2e46
golangci-lint: remove skip-cache and restore singleCaseSwitch rule
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-20 18:43:51 +02:00
Björn Rabenstein 78cd9ae2c3
Merge pull request #12264 from rabenhorst/sample-ring-iterator-mixed-histograms-fix
Fix for `sampleRingIterator` with mixed histograms
2023-04-20 16:58:18 +02:00
Julien Pivotto 637235f0a6 Revert type casting removal
This reverts the removal of type casting due to an error in the
dragonfly integration. The change in the type casting introduced by the
commit causes a type mismatch, resulting in the following errors:

util/runtime/limits_default.go:42:57: cannot use rlimit.Cur (variable of type int64) as type uint64 in argument to limitToString
util/runtime/limits_default.go:42:90: cannot use rlimit.Max (variable of type int64) as type uint64 in argument to limitToString

Reverting this commit to resolve the type mismatch error and maintain compatibility with the dragonfly integration.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-04-20 16:36:25 +02:00
Julien Pivotto f7c6130ff2
Merge pull request #12251 from prymitive/query_samples_total
Add query_samples_total metric
2023-04-20 15:48:24 +02:00
Julien Pivotto e2512078e5
Merge pull request #12241 from mmorel-35/linter/nilerr
enable gocritic, unconvert and unused linters
2023-04-20 15:13:31 +02:00
Bryan Boreham 59176e5a97
Merge pull request #12271 from bboreham/update-go-deps
Update many Go dependencies
2023-04-20 14:23:07 +02:00
gotjosh 2f22c8b7f8
Merge pull request #12270 from prometheus/gotjosh/allow-filtering-of-rules-by-name-api
Rules API: Allow filtering by rule name
2023-04-20 12:03:08 +01:00
gotjosh e78be38cc0
don't show empty groups
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-20 11:20:20 +01:00
gotjosh 74e6668e87
update docs
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-04-20 09:34:15 +01:00