client_golang/prometheus
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
..
collectors Add new go:build lines for go 1.17 2021-12-17 23:38:35 +01:00
graphite fix tests 2019-10-23 00:15:54 +05:00
internal Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
promauto Review feedback: add comment and tests for WrapRegistererWith. 2020-06-04 11:51:51 +01:00
promhttp Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
push Fix typo 2021-11-25 11:21:10 +03:00
testutil Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
.gitignore Rearrange file and package per convention. 2013-04-04 15:27:09 +02:00
README.md Update status badgets 2021-06-23 10:12:43 +02:00
benchmark_test.go Add a benchmark for concurrent counter increments 2018-01-19 15:15:10 -08:00
build_info_collector.go Use the runtime/metrics package for the Go collector for 1.17+ (#955) 2022-01-16 16:41:56 +00:00
collector.go Make the Go 1.17 collector thread-safe (#969) 2022-01-21 08:34:45 +01:00
collector_test.go Add a DescribeByCollect helper 2018-09-05 14:10:51 +02:00
counter.go Use the runtime/metrics package for the Go collector for 1.17+ (#955) 2022-01-16 16:41:56 +00:00
counter_test.go go.*: Update dependencies (#965) 2022-01-18 20:32:44 +01:00
desc.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
desc_test.go Add missing license headers 2018-08-22 13:53:56 +02:00
doc.go Remove obsolete references to `Untyped` from doc comments 2020-02-13 22:03:05 +01:00
example_clustermanager_test.go Nitpicking a doc comment 2018-11-20 13:41:38 +01:00
example_metricvec_test.go Fix linter ignores 2021-03-16 17:19:03 +01:00
example_timer_complex_test.go fix spelling typo 2017-08-28 08:57:51 +08:00
example_timer_gauge_test.go Fix invalid Timer (gauge) example 2017-02-28 11:13:17 -04:00
example_timer_test.go Change the Timer API 2016-11-18 20:32:18 +01:00
examples_test.go Fix linter ignores 2021-03-16 17:19:03 +01:00
expvar_collector.go Add new collectors package 2021-05-08 10:43:31 +09:00
expvar_collector_test.go Simplify if expr in ExampleNewExpvarCollector() 2018-04-13 23:23:52 +02:00
fnv.go Add missing license headers 2018-08-22 13:53:56 +02:00
gauge.go Export MetricVec (again) 2020-10-15 14:32:54 +02:00
gauge_test.go fix tests warning about string(int) type conversions 2020-07-06 21:19:31 +09:00
gen_go_collector_metrics_set.go Reduce granularity of histogram buckets for Go 1.17 collector (#974) 2022-01-28 05:46:45 +01:00
go_collector.go Use the runtime/metrics package for the Go collector for 1.17+ (#955) 2022-01-16 16:41:56 +00:00
go_collector_go116.go Use the runtime/metrics package for the Go collector for 1.17+ (#955) 2022-01-16 16:41:56 +00:00
go_collector_go116_test.go Use the runtime/metrics package for the Go collector for 1.17+ (#955) 2022-01-16 16:41:56 +00:00
go_collector_go117.go Reduce granularity of histogram buckets for Go 1.17 collector (#974) 2022-01-28 05:46:45 +01:00
go_collector_go117_test.go Reduce granularity of histogram buckets for Go 1.17 collector (#974) 2022-01-28 05:46:45 +01:00
go_collector_metrics_go117_test.go Reduce granularity of histogram buckets for Go 1.17 collector (#974) 2022-01-28 05:46:45 +01:00
go_collector_test.go Use simpler locking in the Go 1.17 collector (#975) 2022-01-25 08:43:45 +01:00
histogram.go add ExponentialBucketsRange function (#899) 2021-08-12 16:56:44 +01:00
histogram_test.go go.*: Update dependencies (#965) 2022-01-18 20:32:44 +01:00
labels.go Update code based on the PR feedback 2018-11-02 09:01:14 -07:00
metric.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
metric_test.go Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
observer.go Pull out ...WithExemplar methods into separate interfaces 2020-01-27 15:41:13 +01:00
process_collector.go Add new collectors package 2021-05-08 10:43:31 +09:00
process_collector_other.go Add new go:build lines for go 1.17 2021-12-17 23:38:35 +01:00
process_collector_test.go Add new go:build lines for go 1.17 2021-12-17 23:38:35 +01:00
process_collector_windows.go feat: Change processMemoryCounters struct uint declaration to uintptr 2020-04-13 10:44:09 +08:00
process_collector_windows_test.go Implement process collector for Windows (#596) 2019-06-14 12:26:55 +02:00
registry.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
registry_test.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
summary.go Document implications of negative observations 2021-05-26 23:41:30 +02:00
summary_test.go fix tests warning about string(int) type conversions 2020-07-06 21:19:31 +09:00
timer.go Return observed duration from Timer.ObserveDuration 2018-12-03 21:10:34 +01:00
timer_test.go new handler instrumentation (#285) 2017-04-24 15:13:19 -04:00
untyped.go Remove the deprecated uses of Untyped metrics 2017-08-29 17:31:45 +02:00
value.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
value_test.go Add missing license headers 2018-08-22 13:53:56 +02:00
vec.go Fix typo in comments 2021-02-08 08:58:51 +09:00
vec_test.go Allow currying of metric vec's 2017-12-22 15:56:11 +01:00
wrap.go Added Transactional Gatherer allowed cached solutions (#989) 2022-02-23 11:22:52 +00:00
wrap_test.go Fix linter ignores 2021-03-16 17:19:03 +01:00

README.md

See Go Reference.