Commit Graph

1444 Commits

Author SHA1 Message Date
beorn7 2236d782ff api: Extend and improve json-iterator usage
For one, this pulls up the histogram-related json-iterator usage from
prometheus/common into the API client. Previously, the only
json-iterater usage was here in the API client. But then json-iterator
was used for the native histogram additions directly in
prometheus/common, see
https://github.com/prometheus/common/pull/440/files . This however
meant that any user of prometheus/common/model would now link in
json-iterator, even if they are not using the JSON marshaling at
all. To keep prometheus/common/model more leightweight, this commit
moves all the json-iterator usage into the API client itself, as it
was done before for the normal float samples.

This commit also adds an unmarshaling function for native histograms,
which didn't even exist in prometheus/common/model so far.

It also adds json-iterator marshaling and un-marshaling for
model.SampleStream, which is only needed for the benchmark
(BenchmarkSamplesJsonSerialization). This fixes the benchmark such
that it actually compares json-iterator and std-lib json encoding
(which didn't work before because the custom marshaling methods of
model.SampleStream enforced std-lib json encoding for floats and
json-iterator encoding for histograms in all cases).

I expect this to fix #1179.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-03-01 17:27:33 +01:00
songjiayang 2771bcc5da
Add `Header` method to Pusher for custom header (#1218)
Signed-off-by: songjiayang <songjiayang1@gmail.com>
2023-02-07 16:16:37 +01:00
dependabot[bot] 2fced96110
Bump github.com/prometheus/common from 0.37.0 to 0.39.0 (#1197)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.37.0 to 0.39.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.37.0...v0.39.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 14:28:26 +01:00
PrometheusBot 031748d323
Update common Prometheus files (#1213)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2023-02-01 12:06:38 +01:00
dependabot[bot] b8b41c85ae
Bump golang.org/x/sys from 0.3.0 to 0.4.0 (#1217)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-01 12:04:45 +01:00
Ben Kochie d5a9239503
Merge pull request #1198 from prometheus/dependabot/go_modules/github.com/prometheus/procfs-0.9.0
Bump github.com/prometheus/procfs from 0.8.0 to 0.9.0
2023-01-25 14:37:42 +01:00
Ben Kochie 40692cb9dd
Merge pull request #1199 from prometheus/dependabot/go_modules/github.com/cespare/xxhash/v2-2.2.0
Bump github.com/cespare/xxhash/v2 from 2.1.2 to 2.2.0
2023-01-25 14:37:29 +01:00
Quentin D fcdc3ec54a
Add possibility to dynamically get label values for http instrumentation (#1066)
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>

Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2023-01-19 10:19:08 +00:00
Bryan Boreham fc5f34ceda
Merge pull request #1178 from ibreakthecloud/patch-1
typo fix
2023-01-11 17:45:26 +00:00
dependabot[bot] 14aa20358b
Bump github.com/cespare/xxhash/v2 from 2.1.2 to 2.2.0
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.2 to 2.2.0.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.2...v2.2.0)

---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-01 09:02:31 +00:00
dependabot[bot] 26620fdd58
Bump github.com/prometheus/procfs from 0.8.0 to 0.9.0
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/procfs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-01 09:02:21 +00:00
Alex Goncharov 27f0506d6e
Bump golang.org/x/text to v0.3.8 to mitigate CVE-2022-32149 (#1187)
Signed-off-by: Alex Goncharov <github@b4bay.com>

Signed-off-by: Alex Goncharov <github@b4bay.com>
2022-12-22 16:14:44 +01:00
zhsj 7f99379117
Replace deprecated github.com/golang/protobuf package (#1183)
This replaces usage of proto.{Float64,Int32,Int64,String,Uint32,Uint64},
which doesn't break the interface.

And remove usage of proto.MarshalTextString in wrap_test.go

Updates: #1175

Signed-off-by: Shengjing Zhu <zhsj@debian.org>

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-12-22 16:14:00 +01:00
João Vilaça e29ed9f2cd
Support for multiple samples within same metric (#1181)
Signed-off-by: João Vilaça <jvilaca@redhat.com>

Signed-off-by: João Vilaça <jvilaca@redhat.com>
2022-12-15 16:07:45 +01:00
Quentin D fae2f6306b
Add constrained labels and Constrained variant for all MetricVecs (#1151)
* Introduce MetricVecOpts and add constraints to VariableLabels

MetricVecOpts exposes options specific to MetricVec initialisation. The
first option exposed by MetricVecOpts are constraints on VariableLabels,
allowing restrictions on the possible values a label can take, to
prevent cardinality explosion when the label value comes from a
non-trusted source (as a user input or HTTP header).

Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>

* Add tests

Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>

Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
2022-12-13 13:47:52 +01:00
SpencerMalone 3d765a161a
Add context to "duplicate label names" to enable debugging (#1177)
* Add context to "duplicate label names" to enable debugging

Signed-off-by: SpencerMalone <malone.spencer@gmail.com>

* Remove unused errors package import.

Signed-off-by: SpencerMalone <malone.spencer@gmail.com>

Signed-off-by: SpencerMalone <malone.spencer@gmail.com>
2022-12-13 11:39:55 +01:00
Harshvardhan Karn a787555607
typo fix
Signed-off-by: Harshvardhan Karn <harshvkarn54@gmail.com>
2022-12-06 13:47:40 +05:30
Jéssica Lins 07b1397ded
examples: Add exemplars and middleware examples (#1173)
* Add exemplars simple example, add go runtime and process collectors to simple example

Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>

* Add middleware example

Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>

* Lint

Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>

Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
2022-11-22 22:42:31 +01:00
Bartlomiej Plotka 8b6e68085b
Merge pull request #1171 from prometheus/beorn7/histogram
Fix issue with atomic variables on ppc64le
2022-11-22 13:00:35 +00:00
beorn7 043372ee04 Initialize atomic variables in histogramCounts with atomic.Store...
Signed-off-by: beorn7 <beorn@grafana.com>
2022-11-14 15:03:17 +01:00
beorn7 efef9034c5 Rename histogram tests (from sparse to native)
Signed-off-by: beorn7 <beorn@grafana.com>
2022-11-14 14:53:16 +01:00
Björn Rabenstein 449b464350
Merge pull request #1166 from prometheus/beorn7/doc
Fix typo in doc comment
2022-11-10 09:40:14 +01:00
beorn7 b804be1e63 Fix typo in doc comment
Signed-off-by: beorn7 <beorn@grafana.com>
2022-11-09 17:56:59 +01:00
Kemal Akkoyun db41dad599
Merge pull request #1164 from prometheus/release-1.14
Merge release 1.14 to main
2022-11-08 09:47:31 +01:00
Bartlomiej Plotka 254e546841
Merge pull request #1162 from kakkoyun/cut-1.14.0
Cut v1.14.0
2022-11-08 09:06:03 +01:00
Kemal Akkoyun c8a3d321a0 Cut v1.14.0
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-11-08 05:00:31 +01:00
Bartlomiej Plotka 07d3a81494
Merge pull request #1161 from prometheus/release-1.13
Merge release branch 1.13 to main
2022-11-08 00:15:39 +01:00
Kemal Akkoyun 870469ecf9
Test and support 1.19 (#1160)
* Add new Go 1.19 metrics

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Format files with the latest formatter

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-11-08 00:14:19 +01:00
copy rogers b785d0c828
Fix go_collector_latest_test Fail on go1.19 (#1136)
Signed-off-by: rogerogers <rogers@rogerogers.com>

Signed-off-by: rogerogers <rogers@rogerogers.com>
2022-11-07 20:17:41 +01:00
Seth Bunce 4d54769c6b
Fix float64 comparison test failure on archs using FMA (#1133)
* Fix float64 comparison test failure on archs using FMA

Architectures using FMA optimization yield slightly different results so
we cannot assume floating point values will be precisely the same across
different architectures.

The solution in this change is to check "abs(a-b) < tolerance" instead
of comparing the exact values. This will give us confidence that the
histogram buckets are near identical.

Signed-off-by: Seth Bunce <seth.bunce@getcruise.com>

* Apply suggestions from code review

Co-authored-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Signed-off-by: Seth Bunce <seth.bunce@getcruise.com>

* copy float compare dependency

Per discussion in the pull request, we'd like to avoid having an extra
dependency on a float comparison package. Instead, we copy the float compare
functions from the float comparison package.

The float comparison package we're choosing is this. The author of this
package has commented in the pull request and it looks like we have consensus
that this is the best option.
github.com/beorn7/floats

Signed-off-by: Seth Bunce <seth.bunce@gmail.com>

* remove float32 variant, relocate into separate file

This change removes the float32 variant of the AlmostEqual funcs, that we will
likely never use. This change also relocates the function into a separate file
to avoid modifying a file that's a fork of another vendored package.

Signed-off-by: Seth Bunce <seth.bunce@gmail.com>

Signed-off-by: Seth Bunce <seth.bunce@getcruise.com>
Signed-off-by: Seth Bunce <seth.bunce@gmail.com>
Co-authored-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2022-11-07 19:20:43 +01:00
Kemal Akkoyun 53e51c4f53
Merge pull request #1157 from prometheus/cut-1.13.1
Bugfixes + Cut 1.13.1 + documenting release process.
2022-11-02 09:12:58 +01:00
bwplotka 79ca0eb2ba Added tip from Björn + Grammarly.
Signed-off-by: bwplotka <bwplotka@gmail.com>
2022-11-01 16:54:19 +00:00
bwplotka 078f11f85b Cut 1.13.1 release (+ documenting release process).
Signed-off-by: bwplotka <bwplotka@gmail.com>
2022-11-01 16:37:13 +00:00
Fabian Stäber ddd7f0edcd Fix race condition with Exemplar in Counter (#1146)
* Fix race condition with Exemplar in Counter

Potential fix for #1145.

Signed-off-by: Fabian Stäber <fabian@fstab.de>

* Fix race condition with Exemplar in Counter

Signed-off-by: Fabian Stäber <fabian@fstab.de>

Signed-off-by: Fabian Stäber <fabian@fstab.de>
2022-11-01 16:22:27 +00:00
Balint Zsilavecz 1f93f64580 Fix `CumulativeCount` value of `+Inf` bucket created from exemplar (#1148)
* Fix `CumulativeCount` value of `+Inf` bucket created from exemplar

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Update prometheus/metric_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Clarify description of implicit `+Inf` bucket count

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Fix test variables

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-11-01 16:22:22 +00:00
Dave Henderson 8cc2b6c472 Fix double-counting bug in promhttp.InstrumentRoundTripperCounter (#1118)
Signed-off-by: Dave Henderson <dhenderson@gmail.com>

Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2022-11-01 16:20:44 +00:00
Björn Rabenstein 5f202eefdb
Merge pull request #1150 from prometheus/sparsehistogram
Merge sparsehistogram branch into main
2022-10-31 16:55:36 +01:00
beorn7 fffb76cafe Merge branch 'main' into sparsehistogram 2022-10-31 16:30:59 +01:00
beorn7 e92a8c7f48 Avoid the term 'sparse' where possible
This intends to avoid confusing users by the subtle difference between
a native histogram and a sparse bucket.

Signed-off-by: beorn7 <beorn@grafana.com>
2022-10-31 16:23:08 +01:00
Kemal Akkoyun 0859bb8f37
Merge pull request #1152 from jessicalins/update-to-custom-reg
Update examples to use custom registry
2022-10-26 10:15:58 -04:00
Jéssica Lins a340ca4ba6
Run make format
Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
2022-10-21 17:23:15 +02:00
Jéssica Lins 6056615b26
Update random example to use custom registry
Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
2022-10-21 16:47:21 +02:00
Jéssica Lins 0b7f4888b0
Update simple example to use custom registry
Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
2022-10-21 16:22:25 +02:00
Jéssica Lins 9b5c5b8a47
Update basic example to use custom registry
Signed-off-by: Jéssica Lins <jessicaalins@gmail.com>
2022-10-21 16:06:49 +02:00
beorn7 d31f13b599 Add SparseBucketsZeroThresholdZero and groom doc comments
Signed-off-by: beorn7 <beorn@grafana.com>
2022-10-19 19:22:46 +02:00
beorn7 58a8ca4588 examples: Adjust doc comment for native histograms
Signed-off-by: beorn7 <beorn@grafana.com>
2022-10-19 18:38:57 +02:00
beorn7 4e71e6ff20 Update prometheus/client_model dependency
Native histograms are now in a tagged version (v0.3.0).

Signed-off-by: beorn7 <beorn@grafana.com>
2022-10-19 18:27:50 +02:00
beorn7 111fae11e1 Merge branch 'main' into sparsehistogram 2022-10-19 18:09:21 +02:00
Fabian Stäber 10b0550932
Fix race condition with Exemplar in Counter (#1146)
* Fix race condition with Exemplar in Counter

Potential fix for #1145.

Signed-off-by: Fabian Stäber <fabian@fstab.de>

* Fix race condition with Exemplar in Counter

Signed-off-by: Fabian Stäber <fabian@fstab.de>

Signed-off-by: Fabian Stäber <fabian@fstab.de>
2022-10-17 20:50:50 +02:00
Balint Zsilavecz dcea97eee2
Fix `CumulativeCount` value of `+Inf` bucket created from exemplar (#1148)
* Fix `CumulativeCount` value of `+Inf` bucket created from exemplar

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Update prometheus/metric_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Clarify description of implicit `+Inf` bucket count

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

* Fix test variables

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>

Signed-off-by: Balint Zsilavecz <balint.zsilavecz@skyscanner.net>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-10-13 13:52:19 +02:00