Commit Graph

8945 Commits

Author SHA1 Message Date
beorn7 c35f138a9a Be more specific when identifying a sparse histogram
It's a prefectly valid use case to have a sparse histogram with a zero
threshold of zero (i.e. only observations of exactly zero go into the
zero bucket). Even if the current PoC implementation of client_golang
doesn't allow that, such a case should be ingested properly.

However, there is now the edge case af a sparse histogram with a zero
threshold of zero and no observations yet. Such a histogram would look
the same if it was meant to be a conventional histogram. For now, we
ingest this case as a conventional histogram, but the final format
should have means to unambiguously express if a histogram is meant to
be ingested as a sparse histogram or as a conventional histogram.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-19 19:58:04 +02:00
Ganesh Vernekar 4fefd7520e
Skip the failing TestHistoChunkSameBuckets (#9089)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-15 14:35:35 +05:30
Björn Rabenstein 4e6cb11ea6
Merge pull request #9086 from prometheus/beorn7/protobuf
Add support for missing types in protobuf parsing
2021-07-14 14:36:45 +02:00
beorn7 641c3ae199 protobufparse: Add support for remaining types
Parser now supports summaries and legacy histograms including
exemplars.

It also adds the option of specifying exemplars together with a sparse
histogram by simply using the legacy bucket section, too. The buckets
will be ignored, but the exemplars will be ingested.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-13 20:01:44 +02:00
beorn7 88a6229fc4 protobufparse: add exemplar support for counters
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-13 15:11:26 +02:00
Björn Rabenstein b56f7e8527
Merge pull request #9069 from prometheus/beorn7/protobuf
Add tests for protobuf parser
2021-07-12 12:29:20 +02:00
beorn7 9cdd9cfb8e Add tests for protobuf parser
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-09 21:00:18 +02:00
Ganesh Vernekar 79305e704b
Compare block sizes with sparse histograms (#9045)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-08 11:01:53 +05:30
Björn Rabenstein 08258cc539
Merge pull request #9056 from prometheus/beorn7/histogram2
Fix re-encoding
2021-07-06 01:12:16 +02:00
beorn7 cb75747bce Fix re-encoding
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-06 00:20:35 +02:00
Björn Rabenstein 6b682541f9
Merge pull request #9055 from prometheus/beorn7/histogram
Fix interjections at the end
2021-07-06 00:20:02 +02:00
beorn7 01957eee2b Fix interjections even more
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-05 23:59:33 +02:00
beorn7 dc1c744169 Fix interjections at the end
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-05 23:01:39 +02:00
Björn Rabenstein a979d8e1dc
Merge pull request #9053 from codesome/histo-race
Fix TSDB race while reading histograms
2021-07-05 18:25:36 +02:00
Ganesh Vernekar 1acb701e5c
Fix TSDB race while reading histograms
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-05 21:51:35 +05:30
Ganesh Vernekar 9f206a7a05
Fix race in TSBD while reading/writing histograms (#9051)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-05 21:27:26 +05:30
Björn Rabenstein 63232c1e41
Merge pull request #9048 from prometheus/beorn7/histogram2
Fix lint issues
2021-07-05 15:48:42 +02:00
beorn7 deb02d59fb Fix lint issues
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-05 15:27:46 +02:00
Björn Rabenstein 9cd0297fda
Merge pull request #9047 from Dieterbe/sparsehistogram_dieter
Sparsehistogram: SHS chunk recording and head cutting to head block
2021-07-05 15:07:25 +02:00
Dieter Plaetinck dc6b068c67 bugfix: only bump numRead when all fields are successfully read
Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-07-05 15:57:47 +03:00
Dieter Plaetinck 98f86d671a cleanup comments
Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-07-05 15:56:38 +03:00
Dieter Plaetinck 99ae04bb6f add SHS chunk recoding and head cutting to head block (no tests yet)
Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-07-05 15:56:38 +03:00
Dieter Plaetinck bef872bf3c clarify
Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-07-05 15:56:19 +03:00
Björn Rabenstein 2b2f838a56
Merge pull request #9046 from codesome/hist-rate
Hardcode rate() for sparse histograms
2021-07-05 14:43:42 +02:00
Ganesh Vernekar 4cb4fe44f2
Hardcode rate() for sparse histograms
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-05 16:17:34 +05:30
Ganesh Vernekar 67871fd1f2
Support compaction of Head block for histograms (#9044)
* Update querier.go to support Head compaction with histograms

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

* Add test for Head compaction with histograms

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

* Fix tests

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-04 16:12:37 +05:30
Ganesh Vernekar 4c01ff5194
Bunch of fixes for sparse histograms (#9043)
* Do not panic on histoAppender.Append

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

* M-map all chunks on shutdown

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

* Support negative schema for querying

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-03 23:04:34 +05:30
Ganesh Vernekar 78d68d5972
Make query_range serve histograms (#9036)
* Modify query_range to serve only sparse histograms

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

* Finish CumulativeExpandSparseHistogram for positive schema

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

* Fix lint

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

* Fix bug and comment out tests for query_range

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

* Fix lint 2

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-03 19:23:56 +05:30
Dieter Plaetinck 6c13375ac8
sparsehistogram recoding upon detection that new buckets have appeared (#9030)
* bucketIterator which returns all valid bucket indices for a []span

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* support for comparing []spans and generating interjections

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* add license header

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* assert order fix

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* handle pathological 0-length span case more gracefully

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* stale todo

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* decode-recode histograms when new buckets appear

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* factor out recoding and also add it to the fallback case

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* make linter happy

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-07-02 11:50:30 +05:30
beorn7 518b77c59d Fix a few trivial style nits
Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-01 17:11:54 +02:00
Ganesh Vernekar a1087ed37a
Fix scraping of sparse histograms (#9031)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-07-01 18:19:04 +05:30
Björn Rabenstein dbab4957f7
Merge pull request #9027 from prometheus/beorn7/histogram2
Hacky implementation of protobuf parsing
2021-07-01 12:35:42 +02:00
beorn7 5de2df752f Hacky implementation of protobuf parsing
This "brings back" protobuf parsing, with the only goal to play with
the new sparse histograms.

The Prom-2.x style parser is highly adapted to the structure of the
Prometheus text format (and later OpenMetrics). Some jumping through
hoops is required to feed protobuf into it.

This is not meant to be a model for the final implementation. It
should just enable sparse histogram ingestion at a reasonable
efficiency.

Following known shortcomings and flaws:

- No tests yet.

- Summaries and legacy histograms, i.e. without sparse buckets, are
  ignored.

- Staleness doesn't work (but this could be fixed in the appender, to
  be discussed).

- No tricks have been tried that would be similar to the tricks the
  text parsers do (like direct pointers into the HTTP response
  body). That makes things weird here. Tricky optimizations only make
  sense once the final format is specified, which will almost
  certainly not be the old protobuf format. (Interestingly, I expect
  this implementation to be in fact much more efficient than the
  original protobuf ingestion in Prom-1.x.)

- This is using a proto3 version of metrics.proto (mostly to be
  consistent with the other protobuf uses). However, proto3 sees no
  difference between an unset field. We depend on that to distinguish
  between an unset timestamp and the timestamp 0 (1970-01-01, 00:00:00
  UTC). In this experimental code, we just assume that timestamp is
  never specified and therefore a timestamp of 0 always is interpreted
  as "not set".

Signed-off-by: beorn7 <beorn@grafana.com>
2021-07-01 01:35:11 +02:00
Ganesh Vernekar f4d3af73f0
Query histograms from TSDB and unit test for append+query (#9022)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-30 20:18:13 +05:30
Dieter Plaetinck 4d27816ea5
Sparsehistogram: improve dod encoding, testing, encode chunk metadata (#9015)
* factor out different varbit schemes and include Beorn's "optimum" for buckets

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* use more compact dod encoding scheme for SHS chunk columns

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* remove FB VB and xor dod encoding because we won't use it

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* HistoChunk metadata encoding

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* add SparseHistogram.Copy()

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* histogram test: test appending a few histograms

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* add license headers

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-06-30 16:15:43 +05:30
Ganesh Vernekar 04ad56d9b8
Append sparse histograms into the Head block (#9013)
* Append sparse histograms into the Head block

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

* Add AtHistogram() to Iterator interface. Make HistoChunk conform to Chunk interface.

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-29 20:08:46 +05:30
Dieter Plaetinck 58917d1b76
sparsehistogram: integer types and timestamp separation (#9014)
* integer types and timestamp separation

1) unify types to int64. as suggested by beorn. we want to support
   counters going down (resets) even if we plan to create new chunks for
   now, in that case
2) histogram type doesn't know its own timestamp. include it separately
   in appending and iteration

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* correction: count and zeroCount to remain unsigned

to make api more resilient and that's what we use in protobuf anyway

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* temp hack. Ganesh will fix

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-06-29 19:27:59 +05:30
Dieter Plaetinck fd11a339a7
Sparsehistogram chunk implementation (#9009)
* histogram chunk

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* xorAppender.AppendHistogram non-method

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* basic histogram chunk test

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>
2021-06-29 14:07:41 +05:30
Ganesh Vernekar 64bea6999e
HistogramAppender interface for sparse histograms (#9007)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-06-28 20:30:55 +05:30
Björn Rabenstein df3b674f01
Add metrics.proto to other protobuf code (#8996)
We cannot just use prometheus/client_model directly because we want to
stay consistent with the use of gogo-protobuf. So this converts
metrics.proto to proto3 and edits it lightly so that it fits into
the framework how prometheus/prometheus handles protobuf.

Note that metrics.proto couldn't be merged into the prompb package
because prompb already has an Exemplar type, which is different from
the Exemplar type in metrics.proto. The directory structure seems to
play a role in the protobuf world, so I better kept it.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-06-28 11:16:06 +01:00
Julien Pivotto 3707619900
Merge pull request #8995 from LeviHarrison/reposync-yamllint
Add .yamllint to reposync (and don't run when not installed)
2021-06-25 14:48:35 +02:00
Levi Harrison b7d2f4e189
Only run if yamllint is installed
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-25 08:03:58 -04:00
Levi Harrison b0df5d9568
Added .yamllint to reposync
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-25 07:46:48 -04:00
Ben Kochie ecc5960150
Merge pull request #8991 from roidelapluie/yamllint
Fix yaml indent to make CI happy
2021-06-25 10:04:41 +02:00
Julien Pivotto 17700e5600 Fix yaml indent to make CI happy
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-06-25 00:53:22 +02:00
Levi Harrison d5c3c567d3
Remote Write: Add max samples per metadata send (#8959)
* Added MaxSamplesPerSend

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

* Added tests

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

* Fixed order of require

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

* Added docs

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

* writes -> writesReceived

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

* Improved send loop

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-24 15:39:50 -07:00
Ben Kochie 7cb55d5732
Merge pull request #8802 from mwasilew2/yaml-linting
Adds yamllinting to Makefile.common
2021-06-24 15:59:35 +02:00
Julien Pivotto d8219f29f4
Merge pull request #8983 from roidelapluie/httpsdtests
HTTP SD: Add tests
2021-06-23 12:29:27 +02:00
Julien Pivotto 1deac8f570 HTTP SD: Add tests
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-06-23 09:40:50 +02:00
Julius Volz 4a5aef0495
Merge release-2.28 back into main (#8975)
* Cut v2.28.0-rc.0 (#8954)

* Cut v2.28.0-rc.0

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

* Changelog fixup

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

* Address review comments

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

* Downgrade some features to enhancements

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

* Adjust release date to today

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

* Migrate HTTP SD docs from docs repo (#8972)

See discussion in https://github.com/prometheus/docs/pull/1975

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

* Cut Prometheus v2.28.0 (#8973)

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-06-22 00:59:31 +02:00