Commit Graph

150 Commits

Author SHA1 Message Date
4e491639e6 Merge remote-tracking branch 'getters/metrics'
Some checks failed
main / Build (push) Failing after 9s
2024-11-09 19:39:05 +03:00
cfcb00051e Merge remote-tracking branch 'prometheus/master' 2024-11-09 19:33:55 +03:00
6aa41f4081 change import path
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-11-09 19:32:47 +03:00
Aliaksandr Valialkin
d783709a53
push.go: clarify the docs for PushOptions.Method field
This is a follow-up for 9032bb9e48
Updates https://github.com/VictoriaMetrics/metrics/pull/70
2024-07-16 13:16:48 +02:00
Aliaksandr Valialkin
eba0da061f
process_metrics_linux.go: avoid calling os.Getpagesize() with every writeProcessMetrics() call
It is enough to detect OS page size at the start and then use the detected value.
This removes syscall overhead from every writeProcessMetrics() call.

This is a follow-up for 7b14975dbb
Updates https://github.com/VictoriaMetrics/metrics/pull/76
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6457
2024-07-16 13:11:14 +02:00
Aliaksandr Valialkin
7a44715774
histogram.go: code cleanup after e40cfe3ab5
The Histogram.Merge() function is needed for https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6314

Updates https://github.com/VictoriaMetrics/metrics/pull/73
2024-07-16 12:56:09 +02:00
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
Nikolay
32321d68e1
Merge pull request #77 from VictoriaMetrics/fixed-histogram-merge
fixed histogram merge
2024-07-10 12:44:08 +02:00
AndrewChubatiuk
001417b6f1
fixed tests 2024-07-10 13:30:47 +03:00
AndrewChubatiuk
925f863c7b
fixed histogram merge 2024-07-09 11:04:36 +03:00
Nikolay
d5fb341414
Merge pull request #70 from aierui/request_method
feat: Support configure request method
2024-06-24 09:37:00 +02:00
Nikolay
464c46d5c5
Merge pull request #76 from zhengtianbao/master
Use Getpagesize replace hard-coded page size
2024-06-17 10:02:52 +02:00
zhengtianbao
7b14975dbb Use Getpagesize replace hard-coded page size 2024-06-11 18:03:33 +08:00
AndrewChubatiuk
5e5f209f79
histograms: fixed panic in merge when target bucket is nil 2024-05-20 15:46:52 +03:00
Andrii Chubatiuk
a52bdc6f15
Merge pull request #73 from AndrewChubatiuk/merge-histograms
added function for histograms merge
2024-05-20 13:52:53 +03:00
AndrewChubatiuk
e40cfe3ab5
added function for histograms merge 2024-05-19 11:06:13 +03:00
xsteadfastx
b6cce23ebe
metrics.go: fix typo (#72) 2024-03-19 10:03:09 +01:00
Artem Navoiev
1efad2cf86
change link to metricsql in histogram.go
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2024-03-18 12:24:50 +01:00
Aliaksandr Valialkin
4d19f45b19
counter.go: add Counter.AddInt64() method
This method can be used for avoiding int overflows.
2024-02-24 01:23:22 +02:00
aierui
9032bb9e48 feat: Support configure request method 2024-02-19 22:19:06 +08:00
Aliaksandr Valialkin
da211e52b9
gauge.go: add Inc, Dec and Add methods to Gauge 2024-02-18 12:40:32 +02: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
64b88f0e8f
push.go: document that PushOptions.WaitGroup can be used for waiting for background push workers to stop
This is a follow-up for c45a8b1b70
2024-01-15 21:57:57 +02:00
Aliaksandr Valialkin
c45a8b1b70
push.go: add an ability to wait until push workers are stopped via PushOptions.WaitGroup 2024-01-15 12:07:18 +02:00
hagen1778
49f6df7219
gauge: fix unaligned 64-bit atomic operation panic on 32-bit architectures 2023-12-22 15:54:57 +01:00
hagen1778
fa3e54236d
github-actions: add test for 386 arch 2023-12-22 15:52:25 +01:00
hagen1778
4770da2beb
github-actions: add test for 386 arch 2023-12-22 15:50:59 +01: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
fd25889711
push.go: added PushMetrics() function for force pushing of existing metrics to the specified url
Thanks to @aliaaaaaaaaa for the initial implementation at https://github.com/VictoriaMetrics/metrics/pull/37
2023-12-19 00:20:25 +02:00
Aliaksandr Valialkin
bee9e4faf1
push.go: initialize nil opts with the zero PushOptions inside InitPushExtWithOptions
This makes the InitPushExtWithOptions code more maintainable because of removed checks for nil opts.
2023-12-18 12:51:28 +02:00
Aliaksandr Valialkin
b96951708c
push_test.go: properly close the created httptest.Server after every test call 2023-12-18 12:35:07 +02:00
Aliaksandr Valialkin
de719538d1
push.go: expose InitPushExtWithOptions() function, since this it is neede by VictoriaMetrics 2023-12-17 19:39:36 +02:00
Aliaksandr Valialkin
bd3cd7b6ff
push.go: add ability to cancel periodic push via passed context 2023-12-17 18:23:37 +02:00
Aliaksandr Valialkin
a9e3faa53c
push.go: add InitPushWithOptions() function, which allows extending push options without breaking backwards compatibility and without the need to introduce new functions
Overrides https://github.com/VictoriaMetrics/metrics/pull/53
Overrides https://github.com/VictoriaMetrics/metrics/pull/55

Allows specifying authorization headers via PushOptions.Headers for https://github.com/VictoriaMetrics/metrics/issues/36
Allows disabling request body compression via PushOption.DisableCompression for https://github.com/VictoriaMetrics/metrics/pull/41
2023-12-17 17:42:39 +02:00
Aliaksandr Valialkin
447d235cbb
Do not panic on unsupported Go runtime metrics
Log the unsupported Go runtime metrics on startup instead, so the user is aware of unsupported metrics.
The solution for removing the log lines is to upgrade Go builder.

Reduce the minimum supported Go version at go.mod from Go1.20 to Go1.16, where the runtime/metrics package has been added.
See https://tip.golang.org/doc/go1.16#runtime

Updates https://github.com/VictoriaMetrics/metrics/issues/59
Updates https://github.com/VictoriaMetrics/metrics/pull/60
2023-12-17 16:30:30 +02:00
Aliaksandr Valialkin
cd448dd4c1
Revert "support push config for InitPush (#53)"
This reverts commit 42c28a8486.

Reason for revert: the provided additional public API looks not very good for future support.
See https://github.com/VictoriaMetrics/metrics/pull/53#pullrequestreview-1785442537 for details.
2023-12-17 15:39:32 +02:00
Dmytro Kozlov
42c28a8486
support push config for InitPush (#53)
PushConfig represents a struct package uses for pushing
metrics to remote destination. Having a structure
helps to extend functionality in the future, without
touching the signature of existing functions.

For example, `PushConfig` supports custom HTTP headers
via `Headers` param.

Updates https://github.com/VictoriaMetrics/metrics/issues/52
Updates https://github.com/VictoriaMetrics/metrics/issues/36 

Co-authored-by: hagen1778 <roman@victoriametrics.com>
2023-12-15 13:08:55 +01:00
Aliaksandr Valialkin
2ec14979a8
go_metrics.go: use histogram buckets instead of summary for Go runtime histogram
It is unclear how and when to reset summary - it is smoothed during the Go app uptime.
On the other hand, histogram buckets can be wrapped into increase() or rate() in order
to calculate the histogram distribution on arbitrary time range.

Limit the number of buckets per Go runtime histogram to 30 in order to prevent from high cardinality issues.
2023-11-30 01:50:21 +02:00
Aliaksandr Valialkin
5b58446f57
go_metrics.go: follow-up for 8870cd36e7
- 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
5ad4f70016
go.mod: run `go get -u ./... && go mod tidy && go mod vendor 2023-11-29 23:49:15 +02:00
Nikolay
8870cd36e7
go_metrics: adds new runtime metrics (#58)
* go_metrics: adds new runtime metrics
go_sched_latency_seconds - Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running
go_mutex_wait_total_seconds - Approximate cumulative time goroutines have spent blocked on a sync.Mutex or sync.RWMutex
https://github.com/VictoriaMetrics/metrics/issues/54

* fixes data race

* add tests

* wip

* wip

---------

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-11-29 23:46:41 +02:00
Anshal Shukla
a5eb7684ff add getters to histogram and summary metrics 2023-07-27 13:15:23 +05:30
Nikolay
ae1e9d8058
process_metrics: adds metrics for windows OS (#47)
* process_metrics: adds metrics for windows OS

* windows: fixes build constraints

* bumps github ci go to 1.20 version

* bumps go version at go.mod

* go mod vendor
2023-05-16 09:59:00 -07:00
greyireland
880d8e1cc6 backward compatibility 2023-02-20 12:54:52 +08:00
greyireland
4a30cca184 rename compatible 2023-02-07 15:38:08 +08:00
greyireland
8969e845c9 update nameMetric 2023-02-07 15:15:54 +08:00
greyireland
8466104303 add inf 2023-02-07 15:00:56 +08:00