Commit Graph

1312 Commits

Author SHA1 Message Date
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
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
Tomas Dohnalek cc7991d977
Make Query requests idempotent (#1022)
* Make Query requests idempotent

Address #1020.

Signed-off-by: Tomáš Dohnálek <dohnto@gmail.com>

* Use empty header

Signed-off-by: Tomáš Dohnálek <dohnto@gmail.com>

* Document issue with original documentation

Signed-off-by: Tomáš Dohnálek <dohnto@gmail.com>
2022-04-13 07:21:50 +02:00
Tatsuhiro Tsujikawa 0bab4fda94
push: Add PushContext and AddContext to Pusher (#1028)
Add PushContext and AddContext to Pusher, which are context-aware
version of Push and Add respectively.  They give a caller the ability
to cancel an HTTP request.

Signed-off-by: Tatsuhiro Tsujikawa <ttsujika@zlab.co.jp>
2022-04-12 16:25:43 +02:00
Bartlomiej Plotka 06b641214c
Added info about our slack channel. (#1029) 2022-04-12 16:24:39 +02:00
Kemal Akkoyun 130da3b8ec
Merge pull request #1021 from dohnto/dohnto/line-of-sight
Refactor apiClientImpl.DoGetFallback
2022-04-12 12:15:45 +01:00
Kemal Akkoyun 3e9269d7d3
Merge pull request #1019 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2022-04-11 13:50:41 +01:00
Tomáš Dohnálek 40e54a75a6 Refactor apiClientImpl.DoGetFallback
Make apiClientImpl.DoGetFallback more idiomatic and efficient:
 * Save result of args.Encode() operation as it might be used 2 times in
   the function and due to looping and sorting it might be heavy.
 * Follow line-of-sight practise and therefore simplify the code.

Signed-off-by: Tomáš Dohnálek <dohnto@gmail.com>
2022-04-07 09:18:32 +02:00
prombot e2504f86bb Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-03-31 19:50:35 +00:00
Manuel Rüger 29e8191aff
go.mod: Update dependencies (#1018)
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-03-29 14:15:42 +01:00
Mitsuo Heijo 8dfa334295
Remove workaround for pre go1.15 (#1010)
Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2022-03-27 19:11:56 +01:00
PrometheusBot 3bc8f2c651
Update common Prometheus files (#1009)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-03-18 11:00:13 +00:00
Kemal Akkoyun 6559749c87
Add statebot config (#1001)
* Add statebot config

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

* Disable for milestones

Remove references to remind bot

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-03-17 15:44:57 +00:00
zhijian 36b47eb0ab
When prefix is empty, no more dots should be written (#1005)
Signed-off-by: zhijian <djx@juicedata.io>
2022-03-17 15:43:50 +00:00
Kemal Akkoyun 5d78aaad41
.circleci: Add config to test against go1.18 (#1006)
* Add config to test against go1.18

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

* Try to fix circleci

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-03-17 15:34:12 +00:00
Kemal Akkoyun 157170dd1a
Merge pull request #1007 from prometheus/fix-lint
Fixed lint warning.
2022-03-17 14:26:26 +01:00
Bartlomiej Plotka 9894406186 Fixed lint warning.
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-03-17 11:31:49 +00:00
William Perron 66837e3298
Add exemplar support for const histogram and const metric (#986)
* Add support for exemplars on constHistogram

Co-authored-by: William Perron <william.perron@shopify.com>
Signed-off-by: William Perron <william.perron@shopify.com>

* remove GetExemplars function

Signed-off-by: William Perron <william.perron@shopify.com>

* fixed linting warnings

reduce repetition in constHistogram w/ exemplar

Signed-off-by: William Perron <william.perron@shopify.com>

* Add values to correct bucket

Signed-off-by: William Perron <william.perron@shopify.com>

* Misc fixes

Co-authored-by: Francis Bogsanyi <francis.bogsanyi@shopify.com>

Signed-off-by: William Perron <william.perron@shopify.com>

* avoid panic when there are fewer buckets than exemplars

Co-authored-by: Arun Mahendra <arun.mahendra@shopify.com>

Signed-off-by: William Perron <william.perron@shopify.com>

* Added MustNewMetricWithExemplars that wraps metrics with exemplar (#3)

Changes:
* Make sure to not "leak" dto.Metric
* Reused upper bounds we already have for histogram
* Common code for all types.

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

Co-authored-by: Arun Mahendra <arun.mahendra@shopify.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-03-17 11:30:41 +00:00
Kemal Akkoyun fe8d1e13cd
Merge pull request #1000 from alissa-tung/patch-1
Fix deprecated `NewBuildInfoCollector` API
2022-03-17 08:36:01 +01:00
Kemal Akkoyun 6c18569eab
Merge pull request #1003 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2022-03-17 07:58:06 +01:00
prombot 0291563b9f Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-03-16 19:50:22 +00:00
alissa-tung ffd6362a06 Update Dockerfile example
Signed-off-by: alissa-tung <alissa-tung@outlook.com>

Co-authored-by: Cruise_Hua <zlh429375251@qq.com>
2022-03-16 18:14:51 +08:00
alissa-tung b05177a553 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-03-16 17:46:48 +08:00
PrometheusBot 868ec2137f
Update common Prometheus files (#992)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2022-03-16 08:26:54 +00:00
Bartlomiej Plotka 1f81b3e913
Added Transactional Gatherer allowed cached solutions (#989)
* Added cached collector.

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

update.

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

Attempt 2

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

Added blocking registry, with raw collector and transactional handler.

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

Added fast path to normal (empty) registry to save 8 allocs and 3K5B per Gather.

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

Simplified API, added tests.

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

Fix.

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

Simplified implementation.

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

Added benchmark.

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

Optimized.

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

* Optimization attempt.

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

* Revert "Optimization attempt."

This reverts commit 2fcaf51be9.

Optimization was not worth it:

 benchstat v1.txt v2.txt
name                                                           old time/op    new time/op    delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12    2.64µs ± 0%    4.05µs ± 0%   ~     (p=1.000 n=1+1)
CachedTGatherer_Update/Update_of_all_elements_with_reset-12       701ms ± 0%     358ms ± 0%   ~     (p=1.000 n=1+1)
CachedTGatherer_Update/Gather-12                                  535µs ± 0%  703934µs ± 0%   ~     (p=1.000 n=1+1)

name                                                           old alloc/op   new alloc/op   delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12      208B ± 0%      208B ± 0%   ~     (all equal)
CachedTGatherer_Update/Update_of_all_elements_with_reset-12      40.2MB ± 0%    41.1MB ± 0%   ~     (p=1.000 n=1+1)
CachedTGatherer_Update/Gather-12                                 48.6kB ± 0%    84.3kB ± 0%   ~     (p=1.000 n=1+1)

name                                                           old allocs/op  new allocs/op  delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12      3.00 ± 0%      3.00 ± 0%   ~     (all equal)
CachedTGatherer_Update/Update_of_all_elements_with_reset-12        6.00 ± 0%   4003.00 ± 0%   ~     (p=1.000 n=1+1)
CachedTGatherer_Update/Gather-12                                  1.00k ± 0%     2.01k ± 0%   ~     (p=1.000 n=1+1)

* nit.

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

* Another optimization attempt.

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

* rename and further optimization.

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

* Hopefully final optimization.

benchstat -delta-test=none v6.txt v9.txt
name                                                           old time/op    new time/op    delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12    13.1ms ± 0%     0.0ms ± 0%  -99.81%
CachedTGatherer_Update/Update_of_all_elements_with_reset-12       309ms ± 0%     282ms ± 0%   -8.77%
CachedTGatherer_Update/Gather-12                                  422ms ± 0%       0ms ± 0%  -99.95%

name                                                           old alloc/op   new alloc/op   delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12      208B ± 0%      208B ± 0%    0.00%
CachedTGatherer_Update/Update_of_all_elements_with_reset-12      2.47kB ± 0%    1.67kB ± 0%  -32.56%
CachedTGatherer_Update/Gather-12                                 52.8kB ± 0%    24.6kB ± 0%  -53.34%

name                                                           old allocs/op  new allocs/op  delta
CachedTGatherer_Update/Update_of_one_element_without_reset-12      3.00 ± 0%      3.00 ± 0%    0.00%
CachedTGatherer_Update/Update_of_all_elements_with_reset-12        0.00           0.00         0.00%
CachedTGatherer_Update/Gather-12                                  1.00k ± 0%     0.00k ± 0%  -99.60%

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

* Removed obsolete comment

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

* Fixed tests.

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

* Removed cache.

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

* Fixed tests.

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

* Re-add cache.

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

* Removed cache.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2022-02-23 11:22:52 +00:00
Kemal Akkoyun f3021b0b81
Create codeql-analysis.yml (#982)
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-02-15 10:09:48 +00:00
Kemal Akkoyun 5ac1e9208b
Merge pull request #980 from mrueg/min-go-1.15
go.mod: Set minimal support version of go to 1.15
2022-02-03 09:34:06 +01:00
Manuel Rüger 5678ca5ed1 go.mod: Set minimal support version of go to 1.15
As requested in https://github.com/prometheus/common/pull/353#discussion_r793113705

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-01-31 11:03:13 +01:00
Kemal Akkoyun 2e1c4818cc
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-01-29 15:48:34 +01:00