27 Commits

Author SHA1 Message Date
Aliaksandr Valialkin
17878c4c4e
Make UnregisterSet() less error-prone to use
Previously it was expected that the user calls s.UnregisterAllMetrics() after calling UnregisterSet(s).
This led to many subtle memory leak bugs like https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6247 .

Solve this issue by adding `destroySet bool` arg to UnregisterSet(), so it automatically calls
s.UnregisterAllMetrics() if destroySet=true.

This changes UnregisterSet() function signature, so users need to update UnregisterSet() calls across their code bases
after upgrading to the new version of github.com/VictoriaMetrics/metrics package. This is OK, since this allows
fixing subtle memory leak bugs like https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6247 .
2024-07-15 10:35:32 +02:00
xsteadfastx
b6cce23ebe
metrics.go: fix typo (#72) 2024-03-19 10:03:09 +01:00
Aliaksandr Valialkin
fdfd428a62
Add Set.RegisterMetricsWriter() function for registering user-defined callbacks for arbitrary metrics generation in Prometheus text exposition format 2024-01-16 00:07:12 +02:00
Aliaksandr Valialkin
efd161d607
Expose WriteMetadataIfNeeded() function 2023-12-19 03:07:21 +02:00
Aliaksandr Valialkin
2d7f9a140e
allow passing metric names with labels into Write{Counter,Gauge}{Uint64,Float64} functions 2023-12-19 02:49:57 +02:00
Roman Khavronenko
9dc7358869
allow exposing meta information for registered metrics (#61)
* allow exposing meta information for registered metrics

New public method `ExposeMetadata` allows enabling exposition
of dummy meta-info for all exposed metrics across all Sets.

This feature is needed to improve compatibility
with 3rd-party scrapers that require meta information to be present.

This commit doesn't update exposition of default system/process
metrics to keep the list of changes small. This change should
be added in a follow-up commit.

https://github.com/VictoriaMetrics/metrics/issues/48

* cleanup

* wip

* wip

* wip

* wip

---------

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-12-19 02:36:54 +02:00
Aliaksandr Valialkin
5b58446f57
go_metrics.go: follow-up for 8870cd36e76c191e1868f59846368468e5913919
- Expose Go runtime histograms as summaries, since they have too many buckets,
  which may lead to high cardinality issues at scraper side.

- Expose go_gc_pauses_seconds summary

- Document exposed go_* metrics
2023-11-30 00:58:08 +02:00
Aliaksandr Valialkin
17839691f2
Add UnregisterAllMetrics() and GetDefaultSet() functions
While at it, make sure that ListMetricNames() returns sorted list of the registered metrics
2022-10-25 10:59:37 +03:00
Aliaksandr Valialkin
4ca082233a
all: go fmt from Go1.19 2022-08-08 17:15:06 +03:00
Aliaksandr Valialkin
c6c6640e5b
add RegisterSet() and UnregisterSet() functions for registering the set in metrics export via global WritePrometheus() call 2022-08-08 17:13:46 +03:00
Aliaksandr Valialkin
e9b4bb1534
push.go: expose metrics_push_* metrics related to metrics push process
Updates https://github.com/VictoriaMetrics/metrics/issues/35
2022-08-04 18:12:16 +03:00
sequix
2767350561
Add function to list all metric names from default set (#29) 2022-07-21 18:14:01 +03:00
Aliaksandr Valialkin
bfa3fbc1a7 Document go_memstats_* metrics 2021-03-22 14:36:33 +02:00
Aliaksandr Valialkin
264e71c98a document exported process_* metrics 2021-03-18 18:49:19 +02:00
Aliaksandr Valialkin
c070763356 follow-up for 2a12f948a97173ec8bf4c900e6725712021ef737 2021-02-04 16:28:55 +02:00
Roman Khavronenko
6a144d3619
Add function to unregister metrics from default set #12 (#13) 2020-07-27 22:05:14 +03:00
Roland Lammel
900c892625
Allow unregistration of metrics (#6)
* Allow unregistration of metrics

* Provide metrics.WritePrometheusSet to write using a dedicated metric set

* Cleanup unregister metrics patch, add generic WriteProcessMetrics
2020-02-26 19:52:38 +02:00
Aliaksandr Valialkin
5a9cdd0bef Add process_* metrics similar to the metrics exposed by https://github.com/prometheus/client_golang
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/92
2019-07-12 17:18:57 +03:00
Aliaksandr Valialkin
ebce157dde Add Set for controlling metric sets to be exported via WritePrometheus call 2019-06-01 23:18:41 +03:00
Aliaksandr Valialkin
487af0fbfc Add a reference to VictoriaMetrics in package docs 2019-04-21 02:56:28 +03:00
Aliaksandr Valialkin
fb18155057 metrics.go: remove unused startTime 2019-04-17 14:43:23 +03:00
Aliaksandr Valialkin
4ea76dd6b8 typo fix 2019-04-11 14:04:01 +03:00
Aliaksandr Valialkin
bfffe95d07 refactored and added tests 2019-04-11 13:03:32 +03:00
Aliaksandr Valialkin
6b40edc7ad Return gauge object from NewGauge to be consistent with NewCounter and NewSummary 2019-04-10 15:14:47 +03:00
Aliaksandr Valialkin
d9e8d487bc metrics.go: improve docs 2019-04-08 21:15:17 +03:00
Aliaksandr Valialkin
d3611a2799 Mention how to expose metrics on the /metrics page 2019-04-08 20:51:06 +03:00
Aliaksandr Valialkin
b1d3992f35 Initial commit 2019-04-08 16:29:16 +03:00