20 Commits

Author SHA1 Message Date
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
b23fdf5bd7
gauge.go: add Set() method, which can be used for changing the gauge value without the need to pass callback to NewGauge() 2023-12-20 14:06:44 +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
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
0ee99fd214
set.go: fix data race in Set.ListMetricNames when accessing Set.m map
The Set.m map can be updated by concurrent goroutines when ListMetricNames is called
2021-11-01 14:52:22 +02:00
Roman Khavronenko
be819551e3
summary: fix Unregister behaviour for summary metric type (#16)
The change covers two things:
1. Cleanup of Set.a metrics list from per-quantile metrics
for summary.
2. Register summary metric and per-quantile metrics in one take.
This prevents registry corruption when Unregister called in the
middle of metric register process.
2020-08-07 12:59:44 +03:00
Roman Khavronenko
dd0c59c0d6
Remove timeseries with quantile labels when Unregister is called for summary #14 (#15) 2020-07-28 21:58:28 +03:00
Aliaksandr Valialkin
a494df3462 Properly unregister Summary metric in Set.UnregisterMetric 2020-02-26 20:37:47 +02: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
Ivan G
e6d6f46b5d Proposal: Add new type of counter: FloatCounter (#5)
* Add new type of counter: FloatCounter
* sometimes you need to count things with more precision than uint64
* FloatCounter also usefull if you need setable Gauge w/o callback func

* Fix PR review:
* sync.RWMutex -> sync.Mutex
* more idiomatic add/sub
2020-01-23 12:48:00 +02:00
Aliaksandr Valialkin
fcb89496ec Prevent from possible deadlock in Set.WritePrometheus when Gague callback could call Set.mu.Lock 2019-12-02 22:26:56 +02:00
Aliaksandr Valialkin
eb780f4caa Buffer all the output in memory before writing it to the provided io.Writer in WritePrometheus
This should prevent from indefinite locking of internal structures in the case of laggy io.Writer
2019-11-25 13:01:26 +02:00
Aliaksandr Valialkin
984b12dbb5 Add easy-to-use histograms 2019-11-23 00:16:38 +02:00
Aleksandr Razumov
42ee365914 all: fix typo lables -> labels (#3)
Thanks!
2019-09-30 00:06:17 +03:00
Aliaksandr Valialkin
6fc4c03c79 Update Summary quantiles before writing them to the output.
Previously Summary quantiles were updated after writing them to the output,
so the output contained old quantile values.
2019-06-28 11:13:39 +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