Commit Graph

1261 Commits

Author SHA1 Message Date
Bryan Boreham 4dd3cbb4ab
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-01-25 11:16:10 +01:00
Michael Knyszek 85206714ae
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-01-25 08:43:45 +01:00
Michael Knyszek f63e219e6b
Make the Go 1.17 collector thread-safe (#969) 2022-01-21 08:34:45 +01:00
Kemal Akkoyun 01087964d0
Cut v1.12.0 (#966)
* Cut v1.12.0

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

* Bump the day

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-01-19 07:59:25 +00:00
Kemal Akkoyun 5bd9ee52dc
go.*: Update dependencies (#965)
* Update dependencies

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

* Update deprecated APIs

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

* Add missing dependency explicitly

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-01-18 20:32:44 +01:00
Kemal Akkoyun 9075cdf616
promhttp: Check validity of method and code label values (#962)
* Check validity of method and code label values

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

* Use more flexibly functional option pattern for configuration

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

* Update documentation

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

* Simplify

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

* Fix inconsistent method naming

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2022-01-18 10:19:28 +01:00
Michael Knyszek 22da9497b8
Use the runtime/metrics package for the Go collector for 1.17+ (#955)
This change introduces use of the runtime/metrics package in place of
runtime.MemStats for Go 1.17 or later. The runtime/metrics package was
introduced in Go 1.16, but not all the old metrics were accounted for
until 1.17.

The runtime/metrics package offers several advantages over using
runtime.MemStats:
* The list of metrics and their descriptions are machine-readable,
  allowing new metrics to get added without any additional work.
* Detailed histogram-based metrics are now available, offering much
  deeper insights into the Go runtime.
* The runtime/metrics API is significantly more efficient than
  runtime.MemStats, even with the additional metrics added, because
  it does not require any stop-the-world events.

That being said, integrating the package comes with some caveats, some
of which were discussed in #842. Namely:
* The old MemStats-based metrics need to continue working, so they're
  exported under their old names backed by equivalent runtime/metrics
  metrics.
* Earlier versions of Go need to continue working, so the old code
  remains, but behind a build tag.

Finally, a few notes about the implementation:
* This change includes a whole bunch of refactoring to avoid significant
  code duplication.
* This change adds a new histogram metric type specifically optimized
  for runtime/metrics histograms. This type's methods also include
  additional logic to deal with differences in bounds conventions.
* This change makes a whole bunch of decisions about how runtime/metrics
  names are translated.
* This change adds a `go generate` script to generate a list of expected
  runtime/metrics names for a given Go version for auditing. Users of
  new versions of Go will transparently be allowed to use new metrics,
  however.

Signed-off-by: Michael Anthony Knyszek <mknyszek@google.com>
2022-01-16 16:41:56 +00:00
Łukasz Mierzwa dc1559e8ef
Update /api/v1/status/tsdb to include headStats (#925)
Current structs for v1 HTTP API assume that there is chunkCount and timeSeriesCount on /api/v1/status/runtimeinfo, which seems to be gone for at least a few releases. /api/v1/status/tsdb now holds an extra headStats block with chunkCount, numSeries and a few other fields.
Update API models and tests to reflect this change.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-01-05 10:09:29 +01:00
Kemal Akkoyun e6e54e8082
Merge pull request #944 from yeya24/add-wal-replay-status
API: support wal replay status api
2022-01-05 10:04:10 +01:00
Kemal Akkoyun 98fbd996b0
Merge pull request #952 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2021-12-21 08:41:18 +00:00
prombot 70a41d58f8 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-12-20 20:51:20 +00:00
Kemal Akkoyun dbf420e7ce
Merge pull request #928 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2021-12-20 11:53:34 +00:00
Kemal Akkoyun 1d09783cb9
Merge pull request #950 from mrueg/go-1.17
Add support for go 1.17
2021-12-20 11:51:53 +00:00
Manuel Rüger 8535b62021 Add new go:build lines for go 1.17
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2021-12-17 23:38:35 +01:00
José Carlos Chávez d28a147d3c chore: adds support for go 1.17 on CI.
Signed-off-by: José Carlos Chávez <jcchavezs@gmail.com>
2021-12-17 23:06:20 +01:00
Ben Ye 440c09d3ec support wal replay status api
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
2021-12-04 22:19:58 -08:00
Björn Rabenstein 6d5cf25fcc
Merge pull request #939 from gozeloglu/fix-typo
Fix typo
2021-11-29 13:18:11 +01:00
Gökhan Özeloğlu 55320aa8b0 Fix typo
Signed-off-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
2021-11-25 11:21:10 +03:00
Kemal Akkoyun 1b145cad68
Merge pull request #935 from prometheus/beorn7/examples
example/random: Move flags and metrics into main()
2021-11-10 18:25:28 +01:00
beorn7 f78dc19a65 Move flags and metrics into main()
Fixes #933.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-11-10 16:20:42 +01:00
prombot a7919ad927 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-10-23 00:01:35 +00:00
David Trudgian 679eb0d315
Update cespare/xxhash dependency (#913)
Brings in a fix for asm errors when dynamic linking with Go 1.17.

Fixes #912

Signed-off-by: David Trudgian <david.trudgian@sylabs.io>
2021-09-29 11:11:17 +01:00
Kemal Akkoyun 35ee299e50
Merge pull request #909 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2021-09-20 11:02:35 +02:00
prombot 6cd53c4d83 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-09-16 00:01:42 +00:00
Seth Bunce 2261d5cda1
add ExponentialBucketsRange function (#899)
This function calculates exponential buckets with different arguments
than the existing ExponentialBuckets function. Instead of specifying the
start and factor, the user can specify the min and max bucket value. We
have been doing it this way internally at my company for some time.

Signed-off-by: Seth Bunce <seth.bunce@getcruise.com>
2021-08-12 16:56:44 +01:00
PrometheusBot 20eef74042
Update common Prometheus files (#892)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-07-24 10:31:05 +01:00
Kemal Akkoyun cb5c8ff250
Merge pull request #881 from sivabalan/master
Updating dependency versions + cleanup
2021-07-15 09:12:35 +02:00
Kemal Akkoyun 26d4b4c53e
Merge pull request #885 from prometheus/superq/badgers
Update status badgets
2021-07-15 09:06:41 +02:00
Kemal Akkoyun c7175cc5a5
Merge pull request #888 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2021-07-15 09:06:04 +02:00
prombot e23b9ce547 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-06-25 00:01:28 +00:00
SuperQ 6d946b5526
Update status badgets
Update to new locations
* Switch to CircleCI build badge.
* Use new pkg.go.dev for docs.

Signed-off-by: SuperQ <superq@gmail.com>
2021-06-23 10:12:43 +02:00
Sivabalan Thirunavukkarasu 5426b512dd
Updating dependency versions
Signed-off-by: Sivabalan Thirunavukkarasu <s.thirunavukkarasu@salesforce.com>
2021-06-17 21:04:49 +08:00
Kemal Akkoyun 196536534f
Merge pull request #879 from kakkoyun/fix_changelog
Address minor issues on the changelog
2021-06-07 18:56:00 +02:00
Kemal Akkoyun 64a9c512d4 Address minor issues on Changelog
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2021-06-07 18:44:51 +02:00
Kemal Akkoyun 8184d76b3b
Cut v1.11.0 (#877)
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2021-06-07 13:32:16 +01:00
Ben Kochie 253906201b
Merge pull request #875 from prometheus/superq/update_mods
Update Go modules
2021-06-03 14:03:51 +02:00
SuperQ 68cd1e9262
Update Go modules
Update all modules to the latest versions. This starts to reduce the
indirect dependencies on go-kit/kit in favor of go-kit/log.

Signed-off-by: SuperQ <superq@gmail.com>
2021-06-03 13:16:46 +02:00
Björn Rabenstein f22935db75
Merge pull request #871 from prometheus/beorn7/doc
Document implications of negative observations
2021-06-01 16:46:17 +02:00
Björn Rabenstein 11aba26a91
Change maintainers from @beorn7 to @bwplotka/@kakkoyun (#873)
Lazy consensus was already established among prometheus-team. This
change will be announced on prometheus-developers@ once it is merged.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-06-01 14:13:09 +01:00
beorn7 f34145a85e Document implications of negative observations
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-26 23:41:30 +02:00
Björn Rabenstein a7515ca7c9
Merge pull request #867 from prometheus/beorn7/collectors
Make dbStatsCollector more DRY
2021-05-21 00:23:53 +02:00
beorn7 81a9556c8b Make dbStatsCollector more DRY
Signed-off-by: beorn7 <beorn@grafana.com>
2021-05-20 22:31:53 +02:00
Mitsuo Heijo a66da1df4a
Add collector for database/sql#DBStats (#866)
* Add collector for database/sql#DBStats

Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2021-05-20 22:22:17 +02:00
Björn Rabenstein b89620c491
Merge pull request #862 from johejo/new_collector_package
Add new collectors package
2021-05-10 22:59:20 +02:00
Mitsuo Heijo e07445a773
Add new collectors package
Signed-off-by: Mitsuo Heijo <mitsuo.heijo@gmail.com>
2021-05-08 10:43:31 +09:00
Dean Coakley 3998a677f9
Improve description of MaxAge in summary docs (#864)
* Improve description of MaxAge in summary docs

Signed-off-by: Dean Coakley <dean.s.coakley@gmail.com>
2021-05-04 15:58:41 +02:00
Björn Rabenstein 54867648f2
Merge pull request #861 from yeya24/add-exemplars
Add exemplars API support
2021-04-27 20:06:19 +02:00
yeya24 7a147c1bdf add exemplars API support
Signed-off-by: yeya24 <yb532204897@gmail.com>
2021-04-24 00:32:14 -04:00
Björn Rabenstein 0400fc44d4
Merge pull request #857 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2021-04-14 19:57:22 +02:00
prombot 20b22fe964 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-04-14 00:01:26 +00:00