Commit Graph

265 Commits

Author SHA1 Message Date
Matthieu MOREL 05fba53e57 web : use Go standard package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-11-08 06:37:59 +00:00
Julien Pivotto cf01ec2119
Merge pull request #13091 from mmorel-35/errorlint/util
util: use Go standard errors package
2023-11-07 21:07:25 -06:00
Linas Medziunas ebed7d0612 Change Validate to be a method on histogram structs
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-03 16:47:59 +02:00
Linas Medziunas 1f8aea11d6 Move histogram validation code to model/histogram
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-03 16:17:24 +02:00
Matthieu MOREL fe057fc60d use Go standard errors package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-11-03 07:26:31 +00:00
Björn Rabenstein fae4561369
Merge pull request #12954 from linasm/linasm/optimize-floatBucketIterator2
Histogram performance: optimize floatBucketIterator
2023-11-02 23:59:32 +01:00
Oleksandr Redko fa90ca46e5 ci(lint): enable godot; append dot at the end of comments
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 19:53:38 +02:00
Linas Medžiūnas e3e22abadb
Merge branch 'main' into linasm/optimize-floatBucketIterator2
Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
2023-10-24 16:27:10 +03:00
beorn7 b428416f06 textparse: Update comment about timestamp_ms protobuf parsing
By now, we know better what the plan is.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-10-19 17:54:42 +02:00
Arthur Silva Sens ef8e6ae780
Parse created timestamps from Prometheus Protobuf (#12973)
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-10-18 19:04:02 +01:00
Marc Tuduri 1ce066e51c
More periods
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:53:50 +02:00
Marc Tuduri af7c31ee10
PR feedback
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:53:50 +02:00
Marc Tuduri 8fededf6ad
promql(histograms): Change sample total calculation for histograms
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:51:11 +02:00
Björn Rabenstein f33bffa788
Merge pull request #12891 from linasm/fix-gaps-in-histogram-equals
Fix NaN checks in [Float]Histogram.Equals method
2023-10-18 00:35:17 +02:00
Linas Medziunas 62bbb81e29 Mention bucket values in the comment
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-14 21:30:40 +03:00
Linas Medziunas ec823d9daf Update comments, bitwise comparison of float buckets
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-09 16:09:46 +03:00
Linas Medziunas c5c5c569fa Histogram performance: optimize floatBucketIterator
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-09 09:40:59 +03:00
Matthieu MOREL 0a513f827d ci(lint): enable errorlint linter on model
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-09-29 21:11:33 +00:00
Julien Pivotto c52db2b196 Remove duplicate tests
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 10:41:13 +02:00
johncming 5d68ebb207 pkg/rulefmt: fix bug of validate.
Signed-off-by: johncming <johncming@yahoo.com>
2023-09-29 10:35:07 +02:00
Linas Medziunas 3c047a3518 Expand docs comments
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-09-28 09:08:09 +03:00
Linas Medziunas dfb6292600 Compare FloatHistogram.[Zero]Count float values as binary
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-09-28 09:06:54 +03:00
Linas Medziunas cbd01fc296 Fix NaN sum check in [Float]Histogram.Equals method
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-09-25 16:03:55 +03:00
Goutham Veeramachaneni 86729d4d7b
Update exp package (#12650) 2023-09-21 22:53:51 +02:00
Gregor Zeitlinger f01718262a
Unit tests for native histograms (#12668)
promql: Extend testing framework to support native histograms

This includes both the internal testing framework as well as the rules unit test feature of promtool.

This also adds a bunch of basic tests. Many of the code level tests can now be converted to tests within the framework, and more tests can be added easily.

---------

Signed-off-by: Harold Dost <h.dost@criteo.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
2023-08-25 23:35:42 +02:00
zenador 54aaa2bd7e
Add `histogram_stdvar` and `histogram_stddev` functions (#12614)
* Add new function: histogram_stdvar and histogram_stddev

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-08-24 21:02:14 +02:00
Björn Rabenstein 798c5737a0
Merge pull request #12711 from fatsheep9146/floathistogram-addsub-enhance
enhance float histogram add and sub method
2023-08-24 13:14:10 +02:00
Ziqi Zhao de172049ab fix lint error
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-24 07:27:33 +08:00
Ziqi Zhao d3633d4e76
Update model/histogram/float_histogram.go
Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-24 07:17:23 +08:00
Ziqi Zhao 893f97556f use switch instead of if-else to fix lint error
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-23 13:13:25 +08:00
Ziqi Zhao 788061e509 remove unused addBucket function
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-23 12:55:59 +08:00
Ziqi Zhao eab3c93e80 make code ready for review
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-23 12:52:24 +08:00
beorn7 65ccf4460a textparse: Fix endless loop #12731
PR #12557 introduced the possibility of parsing multiple exemplars per
native histograms. It did so by requiring the `Exemplar` method of the
parser to be called repeatedly until it returns false. However, the
protobuf parser code wasn't correctly updated for the old case of a
single exemplar for a classic bucket (if actually parsed as a classic
bucket) and a single exemplar on a counter. In those cases, the method
would return `true` forever, yielding the same exemplar again and
again, leading to an endless loop.

With this fix, the state is now tracked and the single exemplar is
only returned once.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-08-22 21:03:54 +02:00
beorn7 3d9a830f2f textparse: Expose #12731 in protobufparse_test.go
Signed-off-by: beorn7 <beorn@grafana.com>
2023-08-22 20:53:31 +02:00
György Krajcsovits e846736134 Fix typo
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-08-21 14:13:49 +02:00
Ziqi Zhao 4787c879bc add more elaborate benchmark test
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-21 13:28:06 +08:00
Ziqi Zhao bf880a6e77 enhance floathistogram add and sub method
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-08-16 22:26:31 +08:00
Bryan Boreham d6e1b1acdb
Merge pull request #12681 from prometheus/labels-unused-code
labels: remove some unused code
2023-08-14 15:48:17 +01:00
Bryan Boreham 5007fa305d
Merge pull request #12680 from bboreham/faster-has
labels: improve Has() method for stringlabels build
2023-08-14 15:47:47 +01:00
Bryan Boreham ce260b1fe1 labels: remove some unused code
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-13 15:14:53 +01:00
Bryan Boreham b5c6807fea Labels.Has quick check on first character
Exit early if we've gone past - labels are sorted in order.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-13 15:11:22 +01:00
Bryan Boreham 33aab1b2cc labels: extend benchmark for Has()
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-13 14:55:50 +01:00
Ziqi Zhao ed1b307bca
enhance FloatHistogram CopyToSchema method (#12596)
histogram: Improve performance of FloatHistogram.CopyToSchema

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

---------

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2023-07-27 13:27:13 +02:00
beorn7 c58e20ad0e histogram: Identify native histograms even without observations
Native histograms without observations and with a zero threshold of
zero look the same as classic histograms in the protobuf exposition
format. According to
https://github.com/prometheus/client_golang/issues/1127 , the idea is
to add a no-op span to those histograms to mark them as native
histograms. This commit enables Prometheus to detect that no-op span
and adds a doc comment to the proto spec describing the behavior.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-26 17:42:30 +02:00
Björn Rabenstein 0e12f11d61
Merge pull request #12583 from prometheus/release-2.46
Merge release-2.46 into main
2023-07-20 18:29:44 +02:00
Julien Pivotto 7905594b52
Merge pull request #12557 from prometheus/beorn7/histogram
scrape: Enable ingestion of multiple exemplars per sample
2023-07-20 15:19:28 +02:00
Björn Rabenstein b2567aeacd
Merge pull request #12575 from prometheus/beorn7/histogram2
histogram: Fix bounds of buckets returned by floatBucketIterator
2023-07-20 13:20:51 +02:00
beorn7 9aadd54786 histogram: Fix bounds of buckets returned by floatBucketIterator
The bounds weren't really used so far, so no actual bug in the code so
far. But it's obviously confusing if the bounds returned by a
floatBucketIterator with a target schema different from the original
schema are wrong.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-19 18:19:18 +02:00
beorn7 071f4bbea4 histograms: Fix parsing float histograms without zero bucket
If a float histogram has a zero bucket with a threshold of zero _and_
an empty zero bucket, it wasn't identified as a native histogram
because the `isNativeHistogram` helper function only looked at integer
buckets.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-19 15:29:11 +02:00
beorn7 2ea8df4734 histogram: Expose #12305
Native histograms without a zero threshold aren't federated properly.

This adds a test to prove the specific failure mode, which is that
histograms with a zero threshold of zero are federated as classic
histograms.

The underlying reason is that the protobuf parser identifies a native
histogram by detecting a zero bucket or by detecting integer buckets.
Therefore, a float histogram with a zero threshold of zero and an
unpopulated zero bucket falls through the cracks (no integer buckets,
no zero bucket).

This commit also addse a test case for the latter.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-07-19 15:29:11 +02:00