Commit Graph

1341 Commits

Author SHA1 Message Date
Bartlomiej Plotka c7488be2e4
Added exemplar support to http middleware. (#1055)
* Added exemplar support to http middlewares.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Small fix.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Fixed test.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Added tests and options for RT.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* goimports.

Signed-off-by: bwplotka <bwplotka@gmail.com>
2022-08-02 19:33:08 +02:00
Bartlomiej Plotka 3faf3bae70
Fixed support for unordered input of exemplars. (#1100)
Signed-off-by: bwplotka <bwplotka@gmail.com>
2022-08-02 11:32:30 +02:00
Joseph Woodward 44ce5e1ee5
Ensure tests verify request params (#1047)
* Ensure tests verify request params

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Fix error message

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* gofumpt-ed with extra.

Signed-off-by: bwplotka <bwplotka@gmail.com>

Co-authored-by: bwplotka <bwplotka@gmail.com>
2022-08-02 11:24:17 +02:00
Arun Mahendra 807b1ee73c
explicitly add +inf bucket in withExemplarsMetric (#1094)
* explicitly adding +inf bucket to withExemplarsMetric

Signed-off-by: Arun Mahendra <arun.mahendra@shopify.com>

* Update prometheus/metric_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Update prometheus/metric.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>

* updated comment and removed unnecessary test

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-08-02 10:48:18 +02:00
dependabot[bot] c6d4e40244
Bump github.com/prometheus/procfs from 0.7.3 to 0.8.0 (#1097)
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.7.3 to 0.8.0.
- [Release notes](https://github.com/prometheus/procfs/releases)
- [Commits](https://github.com/prometheus/procfs/compare/v0.7.3...v0.8.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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-02 10:43:54 +02:00
inosato 44c2c4de85
Remove ioutil (#1096)
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-08-02 10:27:49 +02:00
dependabot[bot] 76cdae298e
Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 (#1099)
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.28.0 to 1.28.1.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.28.0...v1.28.1)

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-02 10:24:34 +02:00
dependabot[bot] 9154d30db7
Bump github.com/prometheus/common from 0.35.0 to 0.37.0 (#1098)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.35.0 to 0.37.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.35.0...v0.37.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>
2022-08-02 10:23:53 +02:00
Fredrik Enestad a528affed9
Update documentation for exemplar label limit (#1095)
Signed-off-by: Fredrik Enestad <fredrik@enestad.com>
2022-07-27 17:45:49 +02:00
Bryan Boreham ba4a543ab4
Raise exemplar labels limit from 64 to 128 (#1091)
In line with the OpenMetrics spec:
"The combined length of the label names and values of an Exemplar's
LabelSet MUST NOT exceed 128 UTF-8 character code points"

https://github.com/OpenObservability/OpenMetrics/blob/98ae26c87b/specification/OpenMetrics.md#exemplars

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-07-19 16:50:45 +02:00
Bartlomiej Plotka 3d482bb7cf
Merge pull request #1081 from prometheus/beorn7/release
Merging release branch back to main again
2022-07-07 18:19:45 +02:00
beorn7 c1f2d13898 Merge branch 'release-1.12' into beorn7/release 2022-07-06 16:57:58 +02:00
Björn Rabenstein 5da7b61481
Fix version number in VERSION (#1080)
Signed-off-by: beorn7 <beorn@grafana.com>
2022-07-06 16:42:00 +02:00
Björn Rabenstein c6a634fa36
Merge release-1.12 branch back into main (#1079)
* Cut v1.12.0

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

* Bump the day

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

* Make the Go 1.17 collector thread-safe (#969)

* Use simpler locking in the Go 1.17 collector (#975)

A previous PR made it so that the Go 1.17 collector locked only around
uses of rmSampleBuf, but really that means that Metric values may be
sent over the channel containing some values from future metrics.Read
calls. While generally-speaking this isn't a problem, we lose any
consistency guarantees provided by the runtime/metrics package.

Also, that optimization to not just lock around all of Collect was
premature. Truthfully, Collect is called relatively infrequently, and
its critical path is fairly fast (10s of µs). To prove it, this change
also adds a benchmark.

name            old time/op  new time/op  delta
GoCollector-16  43.7µs ± 2%  43.2µs ± 2%   ~     (p=0.190 n=9+9)

Note that because the benchmark is single-threaded it actually looks
like it might be getting *slightly* faster, because all those Collect
calls for the Metrics are direct calls instead of interface calls.

Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com>

* API client: make http reads more efficient (#976)

Replace `io.ReadAll` with `bytes.Buffer.ReadFrom`.
Both need to resize a buffer until they have finished reading;
the former increases by 1.25x each time while the latter uses 2x.

Also added a benchmark to demonstrate the benefit:
name             old time/op    new time/op    delta
Client/4KB-8       35.9µs ± 4%    35.3µs ± 3%     ~     (p=0.310 n=5+5)
Client/50KB-8      83.1µs ± 8%    69.5µs ± 1%  -16.37%  (p=0.008 n=5+5)
Client/1000KB-8     891µs ± 6%     750µs ± 0%  -15.83%  (p=0.016 n=5+4)
Client/2000KB-8    1.74ms ± 2%    1.35ms ± 1%  -22.72%  (p=0.008 n=5+5)

name             old alloc/op   new alloc/op   delta
Client/4KB-8       20.2kB ± 0%    20.4kB ± 0%   +1.26%  (p=0.008 n=5+5)
Client/50KB-8       218kB ± 0%     136kB ± 0%  -37.65%  (p=0.008 n=5+5)
Client/1000KB-8    5.88MB ± 0%    2.11MB ± 0%  -64.10%  (p=0.008 n=5+5)
Client/2000KB-8    11.7MB ± 0%     4.2MB ± 0%  -63.93%  (p=0.008 n=5+5)

name             old allocs/op  new allocs/op  delta
Client/4KB-8         75.0 ± 0%      72.0 ± 0%   -4.00%  (p=0.008 n=5+5)
Client/50KB-8         109 ± 0%        98 ± 0%  -10.09%  (p=0.079 n=4+5)
Client/1000KB-8       617 ± 0%       593 ± 0%   -3.89%  (p=0.008 n=5+5)
Client/2000KB-8     1.13k ± 0%     1.09k ± 0%   -3.27%  (p=0.008 n=5+5)

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

* Reduce granularity of histogram buckets for Go 1.17 collector (#974)

The Go runtime/metrics package currently exports extremely granular
histograms. Exponentially bucket any histogram with unit "seconds"
or "bytes" instead to dramatically reduce the number of buckets, and
thus the number of metrics.

This change also adds a test to check for expected cardinality to
prevent cardinality surprises in the future.

Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com>

* Cut v1.12.1 (#978)

* Cut v1.12.1

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

* Apply review suggestions

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

* Fix deprecated `NewBuildInfoCollector` API

Update `examples/random/main.go`:
  `prometheus.NewBuildInfoCollector` is deprecated. Use `collectors.NewBuildInfoCollector` instead.

Signed-off-by: alissa-tung <alissa-tung@outlook.com>

* gocollector: Added options to Go Collector for changing the (#1031)

* Renamed files.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* gocollector: Added options to Go Collector for diffetent collections.

Fixes https://github.com/prometheus/client_golang/issues/983

Also:

* fixed TestMemStatsEquivalence, it was noop before (:
* Removed gc_cpu_fraction metric completely, since it's not working completely for Go1.17+

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* gocollector: Reverted client_golang v1.12 addition of runtime/metrics metrics by default. (#1033)

Fixes https://github.com/prometheus/client_golang/issues/967

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* prometheus: Fix convention violating names for generated collector metrics (#1048)

* Fix convention violating names for generated collector metrics

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

* Add new Go collector example

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

* Remove -Inf buckets from go collector histograms (#1049)

* Remove -Inf buckets from go collector histograms

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

* Update prometheus/collectors/go_collector_latest_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Simplify

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

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Cut v1.12.2 (#1052)

* Cut v1.12.2

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

* Apply suggestions

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

* Update CHANGELOG.md

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-authored-by: Michael Knyszek <mknyszek@google.com>
Co-authored-by: Bryan Boreham <bjboreham@gmail.com>
Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
Co-authored-by: alissa-tung <alissa-tung@outlook.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-07-06 16:41:38 +02:00
dependabot[bot] e8f91604d8
Bump github.com/prometheus/common from 0.34.0 to 0.35.0 (#1076)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.34.0 to 0.35.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.34.0...v0.35.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>
2022-07-04 10:31:16 +02:00
Curith 810fcb46ab
Add Error API for pusher (#1075)
Signed-off-by: kun <oiooj@qq.com>
2022-06-30 17:00:36 +02:00
PrometheusBot 4ad265f1b4
Update common Prometheus files (#1068)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-06-20 16:17:57 +02:00
Soroosh Azary Marhabi 2cfd1eb960
Enable same linters as the Prometheus repo itself (#1056)
* Add gofumpt to github workflow & fix all files for it

Signed-off-by: sazary <soroosh@azary.ir>

* Add goimports to golangci & fix it's issues

Signed-off-by: sazary <soroosh@azary.ir>

* Add revive to golangci & fix it's issues

Signed-off-by: sazary <soroosh@azary.ir>

* Add errcheck & misspell to golangci and fix their issues

Signed-off-by: sazary <soroosh@azary.ir>

* Add govet & gosimple to golangci and fix their issues

Signed-off-by: sazary <soroosh@azary.ir>

* Enable all default linters of golangci

Signed-off-by: sazary <soroosh@azary.ir>
2022-06-17 09:04:06 +02:00
PrometheusBot ebd77f0360
Update common Prometheus files (#1064)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-06-14 00:19:38 +02:00
Ben Kochie 2c3d072cdd
Add GitHub settings (#1063)
Add a GitHub settings control yaml to manage branch protection for the
Go versions.

Signed-off-by: SuperQ <superq@gmail.com>
2022-06-07 08:51:36 +02:00
Ben Kochie e38d614cd6
Update minimum supported Go version (#1062)
Update minimum supported Go to 1.17 to support new module format.

Signed-off-by: SuperQ <superq@gmail.com>
2022-06-05 10:01:13 +02:00
PrometheusBot 0dd939295e
Update common Prometheus files (#1061)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-06-03 08:15:32 +02:00
Kemal Akkoyun 5d584e2717
Update readme (#1053)
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-05-14 10:10:15 +02:00
Kemal Akkoyun 0e136d10da
Cut v1.12.2 (#1052)
* Cut v1.12.2

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

* Apply suggestions

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

* Update CHANGELOG.md

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-05-13 11:00:21 +01:00
Kemal Akkoyun 5fe1d33cea Remove -Inf buckets from go collector histograms (#1049)
* Remove -Inf buckets from go collector histograms

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

* Update prometheus/collectors/go_collector_latest_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Simplify

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

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-05-13 10:43:01 +02:00
Kemal Akkoyun 049d0fe55b prometheus: Fix convention violating names for generated collector metrics (#1048)
* Fix convention violating names for generated collector metrics

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

* Add new Go collector example

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-05-13 10:42:43 +02:00
Bartlomiej Plotka 7eb9d111f9 gocollector: Reverted client_golang v1.12 addition of runtime/metrics metrics by default. (#1033)
Fixes https://github.com/prometheus/client_golang/issues/967

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-05-13 10:40:54 +02:00
Bartlomiej Plotka d498b3cdd9 gocollector: Added options to Go Collector for changing the (#1031)
* Renamed files.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* gocollector: Added options to Go Collector for diffetent collections.

Fixes https://github.com/prometheus/client_golang/issues/983

Also:

* fixed TestMemStatsEquivalence, it was noop before (:
* Removed gc_cpu_fraction metric completely, since it's not working completely for Go1.17+

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-05-13 10:37:40 +02:00
alissa-tung 585540a010 Fix deprecated `NewBuildInfoCollector` API
Update `examples/random/main.go`:
  `prometheus.NewBuildInfoCollector` is deprecated. Use `collectors.NewBuildInfoCollector` instead.

Signed-off-by: alissa-tung <alissa-tung@outlook.com>
2022-05-13 10:36:26 +02:00
Kemal Akkoyun 39cf574e99 Cut v1.12.1 (#978)
* Cut v1.12.1

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

* Apply review suggestions

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-05-13 10:35:31 +02:00
Michael Knyszek 9b785b0349 Reduce granularity of histogram buckets for Go 1.17 collector (#974)
The Go runtime/metrics package currently exports extremely granular
histograms. Exponentially bucket any histogram with unit "seconds"
or "bytes" instead to dramatically reduce the number of buckets, and
thus the number of metrics.

This change also adds a test to check for expected cardinality to
prevent cardinality surprises in the future.

Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com>
2022-05-13 10:34:35 +02:00
Bryan Boreham 5a529ae06b API client: make http reads more efficient (#976)
Replace `io.ReadAll` with `bytes.Buffer.ReadFrom`.
Both need to resize a buffer until they have finished reading;
the former increases by 1.25x each time while the latter uses 2x.

Also added a benchmark to demonstrate the benefit:
name             old time/op    new time/op    delta
Client/4KB-8       35.9µs ± 4%    35.3µs ± 3%     ~     (p=0.310 n=5+5)
Client/50KB-8      83.1µs ± 8%    69.5µs ± 1%  -16.37%  (p=0.008 n=5+5)
Client/1000KB-8     891µs ± 6%     750µs ± 0%  -15.83%  (p=0.016 n=5+4)
Client/2000KB-8    1.74ms ± 2%    1.35ms ± 1%  -22.72%  (p=0.008 n=5+5)

name             old alloc/op   new alloc/op   delta
Client/4KB-8       20.2kB ± 0%    20.4kB ± 0%   +1.26%  (p=0.008 n=5+5)
Client/50KB-8       218kB ± 0%     136kB ± 0%  -37.65%  (p=0.008 n=5+5)
Client/1000KB-8    5.88MB ± 0%    2.11MB ± 0%  -64.10%  (p=0.008 n=5+5)
Client/2000KB-8    11.7MB ± 0%     4.2MB ± 0%  -63.93%  (p=0.008 n=5+5)

name             old allocs/op  new allocs/op  delta
Client/4KB-8         75.0 ± 0%      72.0 ± 0%   -4.00%  (p=0.008 n=5+5)
Client/50KB-8         109 ± 0%        98 ± 0%  -10.09%  (p=0.079 n=4+5)
Client/1000KB-8       617 ± 0%       593 ± 0%   -3.89%  (p=0.008 n=5+5)
Client/2000KB-8     1.13k ± 0%     1.09k ± 0%   -3.27%  (p=0.008 n=5+5)

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2022-05-13 10:34:23 +02:00
Michael Knyszek d32edd6083 Use simpler locking in the Go 1.17 collector (#975)
A previous PR made it so that the Go 1.17 collector locked only around
uses of rmSampleBuf, but really that means that Metric values may be
sent over the channel containing some values from future metrics.Read
calls. While generally-speaking this isn't a problem, we lose any
consistency guarantees provided by the runtime/metrics package.

Also, that optimization to not just lock around all of Collect was
premature. Truthfully, Collect is called relatively infrequently, and
its critical path is fairly fast (10s of µs). To prove it, this change
also adds a benchmark.

name            old time/op  new time/op  delta
GoCollector-16  43.7µs ± 2%  43.2µs ± 2%   ~     (p=0.190 n=9+9)

Note that because the benchmark is single-threaded it actually looks
like it might be getting *slightly* faster, because all those Collect
calls for the Metrics are direct calls instead of interface calls.

Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com>
2022-05-13 10:34:13 +02:00
Michael Knyszek 772b89389c Make the Go 1.17 collector thread-safe (#969) 2022-05-13 10:33:54 +02:00
dependabot[bot] fab6748c34
Bump github.com/prometheus/common from 0.33.0 to 0.34.0 (#1051)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.33.0 to 0.34.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.33.0...v0.34.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>
2022-05-13 10:20:41 +02:00
Ben Kochie edecbb214b
Enable dependabot (#1050)
Update Go deps monthly.

Signed-off-by: SuperQ <superq@gmail.com>
2022-05-13 10:05:17 +02:00
Kemal Akkoyun 35c82f2c7e
Remove -Inf buckets from go collector histograms (#1049)
* Remove -Inf buckets from go collector histograms

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

* Update prometheus/collectors/go_collector_latest_test.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>

* Simplify

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

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-05-13 10:04:45 +02:00
Kemal Akkoyun f25114699a
prometheus: Fix convention violating names for generated collector metrics (#1048)
* Fix convention violating names for generated collector metrics

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

* Add new Go collector example

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-05-09 10:33:45 +02:00
PrometheusBot 589b2ea560
Update common Prometheus files (#1046)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-05-06 08:09:49 +02:00
PrometheusBot 0222f88f4a
Update common Prometheus files (#1045)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-05-05 07:46:54 +02:00
Christoph Mewes 24605c59ac
update branch names in a few links (#1039)
Signed-off-by: Christoph Mewes <christoph@kubermatic.com>
2022-05-02 16:44:08 +02:00
S Santhosh Nagaraj 404809144b
client: Allow configuration of http client (#1025)
* client: Allow configuration of http client

Signed-off-by: yolossn <nssvlr@gmail.com>

* Add api.Config validation to prevent confusion

Update config documentation

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

Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-04-29 15:02:44 +01:00
Joseph Woodward efe8e6fac8
Document WithTimeout options for Query/QueryRange (#1037)
Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>
2022-04-29 06:34:50 +01:00
Zach Stone 4dcf02ec7b
Implement deletion based on partially matching labels (#1013)
* WIP partial match

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Cleanup

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Comments

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Tests and comments

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Handle properly deleting multiple metrics, update tests

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Comments

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Try using curry values

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Skip curry value to demo

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Fix curry deletion, remove outdated comment.

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Fix logic for deletion of metrics from prior to currying

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Don't match curried values. Update tests.

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Remove unneccesasry helper and todo comments

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Comment about partial matching curried labels

Signed-off-by: Zach Stone <zach@giantswarm.io>

* Simplify curried value check

Signed-off-by: Zach Stone <zach@giantswarm.io>
2022-04-21 08:29:05 +02:00
Joseph Woodward 48a686a603
Update query API to support timeouts (#1014)
* Add timeout parameter for queries

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Update api/prometheus/v1/api.go

Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Update api/prometheus/v1/api.go

Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Pass timeout as stringified time.Duration instead of millisecond value

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Update QueryRange API to support timeouts

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

* Add timeout to test request params

Signed-off-by: Joseph Woodward <joseph.woodward@xeuse.com>

Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
2022-04-21 07:23:16 +02:00
Bartlomiej Plotka 11ee9add27
gocollector: Reverted client_golang v1.12 addition of runtime/metrics metrics by default. (#1033)
Fixes https://github.com/prometheus/client_golang/issues/967

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-04-13 20:43:29 +02:00
Sourik Ghosh cd90f33be8
smart diff to testutil.GatherAndCompare (#998)
* added smart diff to testutil.GatherAndCompare

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* v2 testuitls added for better diff

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* replaced CollectAndCompare to CollectAndCompareV2 in testutil_test

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* renamed methods from v2 to withT

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* replaced testify with custom diff func

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* difflib GetUnifiedDiffString added with test

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* license meta data added to file

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>

* moved difflib to internal

Signed-off-by: Sourik Ghosh <sourikghosh31@gmail.com>
2022-04-13 18:38:05 +01:00
Manuel Rüger 0c691ed35f
go.mod: Exclude prometheus/client_golang v1.12.1 (#1027)
See also https://github.com/prometheus/client_golang/issues/1012

As suggested in https://github.com/prometheus/client_golang/issues/1012#issuecomment-1090482644

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-04-13 18:35:14 +01:00
Manuel Rüger 46d3dd4e6c
Bump minimum required Go version to 1.16 (#1032)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-04-13 16:21:42 +01:00
Bartlomiej Plotka 24172847e3
gocollector: Added options to Go Collector for changing the (#1031)
* Renamed files.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* gocollector: Added options to Go Collector for diffetent collections.

Fixes https://github.com/prometheus/client_golang/issues/983

Also:

* fixed TestMemStatsEquivalence, it was noop before (:
* Removed gc_cpu_fraction metric completely, since it's not working completely for Go1.17+

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-04-13 09:55:22 +01:00