Commit graph

10693 commits

Author SHA1 Message Date
Björn Rabenstein 2915e4960c
Merge pull request #11395 from codesome/histometrics
Update metrics for histograms
2022-10-05 18:20:15 +02:00
Björn Rabenstein 83901e7cac
Merge pull request #11402 from codesome/moar-tests
Add API test for histogram
2022-10-05 18:12:06 +02:00
Peter Štibraný fdf55df80c Update github.com/grafana/regexp to use speedup-golang-1.19.2 branch
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
2022-10-05 11:57:31 +02:00
Ganesh Vernekar 73d805cf6c
Merge pull request #11414 from prometheus/release-2.39
Merge release branch into main
2022-10-05 11:38:00 +05:30
Ganesh Vernekar 6d7f26c46f
Cut v2.39.0 (#11407)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Augustin Husson <augustin.husson@amadeus.com>
Co-authored-by: Augustin Husson <augustin.husson@amadeus.com>
2022-10-05 10:19:27 +05:30
Ganesh Vernekar f7a7b18cdc
Merge pull request #11403 from prometheus/release-2.39
Merge release-2.39 into main again
2022-10-03 19:49:34 +05:30
Augustin Husson ffb0ec2ca4
adjust package-json to match the correct version of the modules (#11401)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-10-03 19:16:41 +05:30
Ganesh Vernekar f024d769e7
Add API test for histogram
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-10-03 18:53:57 +05:30
Julien Pivotto 9e220f552f
Merge pull request #11398 from prometheus/release-2.39
Merge back release 2.39
2022-10-03 14:23:43 +02:00
Björn Rabenstein dccfb9db4e
histogram: Remove code replication via generics (#11361)
* histogram: Simplify iterators

We don't really need currLower and currUpper and can calculate it when
needed (as already done for the floatBucketIterator). The calculation
is cheap, while keeping those extra variables around costs RAM
(potentially a lot with many iterators).

* histogram: Convert Bucket/FloatBucket to one generic type

* histogram: Move some bucket iterator code into generic base iterator

* histogram: Remove cumulative iterator for FloatHistogram

We added it in the past for completeness (Histogram has one), but it
has never been used. Plus, even the cumulative iterator for Histogram
is only there for test reasons.

We can always add it back, and then maybe even using generics.

Signed-off-by: beorn7 <beorn@grafana.com>
2022-10-03 16:45:27 +05:30
Gabriel Goller 04dd6be1a0
Added yamllint rule to ignore "on" in github actions (#11396)
Currently all the github actions return warnings because the "on"
keyword in the yaml files are being interpreted as a "truthy" value by
yamllint. To ignore this behavior I added a rule which ignores the "on".
See https://github.com/adrienverge/yamllint/issues/430.

Signed-off-by: Gabriel Goller <gabriel.goller@acs.it>

Signed-off-by: Gabriel Goller <gabriel.goller@acs.it>
Co-authored-by: Gabriel Goller <gabriel.goller@acs.it>
2022-10-03 12:52:57 +02:00
Ganesh Vernekar d0a6488c74
Update metrics for histograms
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-10-03 13:48:59 +05:30
Bryan Boreham 8120af22e2 benchmarks: SetBytes takes bytes per operation
Where the code was multiplying bytes by number of operations, this
resulted in absurdly high throughput numbers.

Also, in `BenchmarkParse()`, don't run the `expfmt` case twice.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-10-02 22:11:33 +02:00
dependabot[bot] c8786974d1 build(deps): bump github.com/aws/aws-sdk-go from 1.44.102 to 1.44.109
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.44.102 to 1.44.109.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.44.102...v1.44.109)

---
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>
2022-10-02 22:10:26 +02:00
dependabot[bot] 442e608bf7 build(deps): bump actions/cache from 3.0.8 to 3.0.9
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.8 to 3.0.9.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.8...v3.0.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-02 22:10:07 +02:00
dependabot[bot] 2673f94eb1 build(deps): bump k8s.io/client-go from 0.25.1 to 0.25.2
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.25.1 to 0.25.2.
- [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.25.1...v0.25.2)

---
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-10-02 22:09:44 +02:00
dependabot[bot] f475bc7ddb build(deps): bump github.com/linode/linodego from 1.9.1 to 1.9.3
Bumps [github.com/linode/linodego](https://github.com/linode/linodego) from 1.9.1 to 1.9.3.
- [Release notes](https://github.com/linode/linodego/releases)
- [Commits](https://github.com/linode/linodego/compare/v1.9.1...v1.9.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-02 22:09:34 +02:00
Julius Volz 80a09d06ad
Fix EC2/Lightsail SD changelog entries for 2.39.x (#11377)
* Fix EC2/Lightsail SD changelog entries for 2.39.x

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Fixup

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Fixup 2

Signed-off-by: Julius Volz <julius.volz@gmail.com>

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2022-10-02 19:35:17 +02:00
Bryan Boreham 9b31adc4e8
tsdb: fix up sort call with faster slices.Sort (#11380)
This call was added by PR #11075 merged before #11318 which changed all
similar calls to `sort.Sort` into a faster one.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-10-01 12:55:40 -04:00
Giedrius Statkevičius a1d6ba59ac
promql: pass down subquery interval (#11163)
If we are populating series for a subquery then set the interval
parameter accordingly so that downstream users could use that
information.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
2022-09-30 20:13:38 +05:30
Bryan Boreham 3330d85ba8
Replace sort.Strings and sort.Ints with faster slices.Sort (#11318)
Use new experimental package `golang.org/x/exp/slices`.

slices.Sort works on values that are directly comparable, like ints,
so avoids the overhad of an interface call to `.Less()`.

Left tests unchanged, because they don't need the speed and it may be
a cross-check that slices.Sort gives the same answer.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-09-30 20:03:56 +05:30
Bryan Boreham 7f2374b703
tsdb: faster postings sort with generic slices.Sort (#11054)
Use new experimental package `golang.org/x/exp/slices`.

Some of the speedup comes from comparing SeriesRef (which is an int64)
directly rather than through an interface `.Less()` call; some comes
from exp/slices using "pattern-defeating quicksort(pdqsort)".

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-09-30 20:01:32 +05:30
Julien Pivotto d104977f23
Fix inputs var name (#11375)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-30 17:53:38 +05:30
Julien Pivotto 15ade71312
Fix typo in publish_release_images (#11374)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-30 16:02:45 +05:30
Julien Pivotto 37088df58b Do not reupload artefacts
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-30 11:20:22 +02:00
Julien Pivotto 15e1148251 Use github token to publish release
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-30 11:20:22 +02:00
Frederic Branczyk c48d8df627
Merge pull request #11353 from mborsz/protobuf
Use protobuf encoding in kubernetes discovery
2022-09-30 10:38:37 +02:00
Ganesh Vernekar 23588fb43a
Bump the UI package to v2.39.0-rc.0 (#11367)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-30 13:04:19 +05:30
Julius Volz fbec3bfc90
Small improvements to out-of-order ingestion docs (#11366)
Signed-off-by: Julius Volz <julius.volz@gmail.com>

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2022-09-30 09:13:32 +02:00
Marijn Haverbeke 8dbb2eaf0b
Clean up the Lezer grammar output tree (#11333)
Signed-off-by: Marijn Haverbeke <marijn@haverbeke.nl>
2022-09-29 22:26:46 +02:00
Miguel Ángel Ortuño e4b87a7a2a
api: export point marshaling functions (#11323)
Export `marshalTimestamp` and `marshalValue` functions by moving them under their own util package.

Signed-off-by: Miguel Ángel Ortuño <ortuman@gmail.com>
2022-09-29 20:16:48 +05:30
Ganesh Vernekar 614d6c0c84
Update the VERSION file to say v2.39.0-rc.0 (#11364)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-29 13:47:35 +05:30
Ganesh Vernekar 9b2b993157
Cut v2.39.0-rc.0 (#11344)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-29 12:27:30 +05:30
Ganesh Vernekar 83d738e263
Fix 'invalid magic number 0' bug (#11338)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-28 21:43:58 +05:30
Ganesh Vernekar f371d7f0fb
Add docs for out of order ingestion (#11340)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: Levi Harrison <levisamuelharrison@gmail.com>
2022-09-28 20:01:21 +05:30
Ganesh Vernekar f34aeefe6e
Allow overlapping blocks by default (#11331)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-28 19:17:54 +05:30
Robert Fratto 448cfda6c1
tsdb/agent: fix validation of default options (#9876)
* tsdb/agent: fix application of defaults

MaxTS was being incorrectly constrained to the truncation interval

* add more tests to check validation

* force MaxWALTime = MinWALTime if min > max

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2022-09-27 19:41:43 +05:30
Bryan Boreham d166da7b59
tsdb: stop saving a copy of last 4 samples in memSeries (#11296)
* TSDB chunks: remove race between writing and reading

Because the data is stored as a bit-stream, the last byte in the stream
could change if the stream is appended to after an Iterator is obtained.
Copy the last byte when the Iterator is created, so we don't have to
read it later.

Clarify in comments that concurrent Iterator and Appender are allowed,
but the chunk must not be modified while an Iterator is created.
(This was already the case, in order to copy the bstream slice header.)

* TSDB: stop saving last 4 samples in memSeries

This extra copy of the last 4 samples was introduced to avoid a race
condition between reading the last byte of the chunk and writing to it.

But now we have fixed that by having `bstreamReader` copy the last byte,
we don't need to copy the last 4 samples.

This change saves 56 bytes per series, which is very worthwhile when
you have millions or tens of millions of series.

* TSDB: tidy up stopIterator re-use

Previous changes have left this code duplicating some lines; pull
them out to a separate function and tidy up.

* TSDB head_test: stop checking when iterators are wrapped

The behaviour has changed so chunk iterators are only wrapped when
transaction isolation requires them to stop short of the end.
This makes tests fail which are checking the type.

Tests should check the observable behaviour, not the type.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-27 19:32:05 +05:30
Bryan Boreham ff00dee262
tsdb: turn off transaction isolation for head compaction (#11317)
* tsdb: add a basic test for read/write isolation

* tsdb: store the min time with isolationAppender
So that we can see when appending has moved past a certain point in time.

* tsdb: allow RangeHead to have isolation disabled
This will be used when for head compaction.

* tsdb: do head compaction with isolation disabled
This saves a lot of work tracking appends done while compaction is ongoing.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-09-27 19:31:23 +05:30
Björn Rabenstein a01b3d7a14
Merge pull request #11312 from prometheus/beorn7/sparsehistogram
Compact histograms on ingestion
2022-09-27 13:38:17 +02:00
beorn7 a7c519930e histograms: Add Compact method to the normal integer Histogram
And use the new method to call to compact Histograms during
parsing. This happens for both `Histogram` and `FloatHistogram`. In
this way, if targets decide to optimize the exposition size by merging
spans with empty buckets in between, we still get a normalized
results. It will also normalize away any valid but weird
representations like empty spans, spans with offset zero, and empty
buckets at the start or end of a span.

The implementation seemed easy at first as it just turns the
`compactBuckets` helper into a generic function (which now got its own
file). However, the integer Histograms have delta buckets instead of
absolute buckets, which had to be treated specially in the generic
`compactBuckets` function. To make sure it works, I have added plenty
of explicit tests for `Histogram` in addition to the `FloatHistogram`
tests.

I have also updated the doc comment for the `Compact` method.

Based on the insights now expressed in the doc comment, compacting
with a maxEmptyBuckets > 0 is rarely useful. Therefore, this commit
also sets the value to 0 in the two cases we were using 3 so far. We
might still want to reconsider, so I don't want to remove the
maxEmptyBuckets parameter right now.

Signed-off-by: beorn7 <beorn@grafana.com>
2022-09-27 13:04:16 +02:00
Bryan Boreham d0607435a2
tsdb: remove chunkRange and oooCapMax from memSeries (#11288)
* tsdb: remove chunkRange from memSeries

chunkRange is the (oddly-named) configured duration for the head block.

We don't need a copy of this value per series. Pass it down where
required, and remove the copy.

The value in `Head` is only updated in `resetInMemoryState()`, which
also discards all `memSeries`.

* tsdb: remove oooCapMax from memSeries

oooCapMax is the configured maximum capacity for an out-of-order chunk.

Storing it per-series uses extra memory, and has surprising behaviour
if users change the value in config - series created before the change
will keep their old value.

Instead, pass it down where required, and remove the per-series value.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-27 13:52:22 +05:30
Paschalis Tsilias f2ee959354
Remove 'metadata-storage' CLI flag (#11351)
Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>

Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
2022-09-27 12:05:09 +05:30
Maciej Borsz 56eba3ace2 Use protobuf encoding in client-go
Signed-off-by: Maciej Borsz <maciejborsz@google.com>
2022-09-26 12:54:33 +00:00
Ganesh Vernekar 758e29258b
Add/Improve unit tests for compaction with histogram Part 2 (#11343)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-23 14:01:10 +05:30
Augustin Husson 734772f828
upgrade go version on gitpod (#11335)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-09-22 10:21:46 +02:00
Ganesh Vernekar da42612dbd
Update dependencies for v2.39 (#11330)
* Update Go dependencies

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Undo azure-sdk-for-go upgrade

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2022-09-22 13:02:12 +05:30
Augustin Husson f67f87c82b
Update npm deps for v2.39 and fix the script called to do it (#11332)
* fix the way to get the list of workspaces

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

* update UI dependencies

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

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-09-21 23:36:28 +02:00
Jesus Vazquez c1b669bf9b
Add out-of-order sample support to the TSDB (#11075)
* Introduce out-of-order TSDB support

This implementation is based on this design doc:
https://docs.google.com/document/d/1Kppm7qL9C-BJB1j6yb6-9ObG3AbdZnFUBYPNNWwDBYM/edit?usp=sharing

This commit adds support to accept out-of-order ("OOO") sample into the TSDB
up to a configurable time allowance. If OOO is enabled, overlapping querying
are automatically enabled.

Most of the additions have been borrowed from
https://github.com/grafana/mimir-prometheus/
Here is the list ist of the original commits cherry picked
from mimir-prometheus into this branch:
- 4b2198d7ec
- 2836e5513f
- 00b379c3a5
- ff0dc75758
- a632c73352
- c6f3d4ab33
- 5e8406a1d4
- abde1e0ba1
- e70e769889
- df59320886

Co-authored-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: Dieter Plaetinck <dieter@grafana.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* gofumpt files

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Add license header to missing files

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix OOO tests due to existing chunk disk mapper implementation

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix truncate int overflow

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Add Sync method to the WAL and update tests

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* remove useless sync

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Update minOOOTime after truncating Head

* Update minOOOTime after truncating Head

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix lint

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Add a unit test

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Load OutOfOrderTimeWindow only once per appender

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix OOO Head LabelValues and PostingsForMatchers

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix replay of OOO mmap chunks

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Remove unnecessary err check

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Prevent panic with ApplyConfig

Signed-off-by: Ganesh Vernekar 15064823+codesome@users.noreply.github.com
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Run OOO compaction after restart if there is OOO data from WBL

Signed-off-by: Ganesh Vernekar 15064823+codesome@users.noreply.github.com
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Apply Bartek's suggestions

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Refactor OOO compaction

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Address comments and TODOs

- Added a comment explaining why we need the allow overlapping
  compaction toggle
- Clarified TSDBConfig OutOfOrderTimeWindow doc
- Added an owner to all the TODOs in the code

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Run go format

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix remaining review comments

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Change wbl reference when truncating ooo in TestHeadMinOOOTimeUpdate

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* Fix TestWBLAndMmapReplay test failure on windows

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Address most of the feedback

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Refactor the block meta for out of order

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix windows error

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

* Fix review comments

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
Signed-off-by: Ganesh Vernekar 15064823+codesome@users.noreply.github.com
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
Co-authored-by: Dieter Plaetinck <dieter@grafana.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-09-20 22:35:50 +05:30
Bryan Boreham af6167df58
WAL loading: don't send empty buffers over chan (#11319)
If some shards did not get any samples mapped, the buffer will be empty
so sending it over the chan to `processWALSamples()` is a waste of time.

This is especially likely now we are checking `minValidTime` before
sending.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-09-20 19:43:30 +05:30