19 Commits

Author SHA1 Message Date
aierui
9032bb9e48 feat: Support configure request method 2024-02-19 22:19:06 +08: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 c45a8b1b70076d800ad2cc970abff10dd543e56a
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
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
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
cd448dd4c1
Revert "support push config for InitPush (#53)"
This reverts commit 42c28a8486fb3f180026c0b2c90643ac9e91951e.

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
4ca082233a
all: go fmt from Go1.19 2022-08-08 17:15:06 +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
Aliaksandr Valialkin
fe970f4df0
push.go: properly flush compressed metrics to pushURL 2022-07-25 10:37:04 +03:00
Aliaksandr Valialkin
b305bc011e
push.go: push metrics to remote storage in gzip-compressed form
This should reduce the needed network bandwidth by ~10x for reading the metrics at remote storage side
2022-07-25 10:19:30 +03:00
Aliaksandr Valialkin
f790ba580c
return error instead of panicing in InitPush* functions 2022-07-21 19:45:07 +03:00
Aliaksandr Valialkin
195ac63dbf
Improve error logging when metrics cannot be pushed to pushURL passed to InitPush*() 2022-07-21 19:32:48 +03:00
Aliaksandr Valialkin
3515499561
Export InitPushExt function for pushing metrics provided via caller callback 2022-07-21 18:35:46 +03:00
Aliaksandr Valialkin
aab1d62de8
push.go: limit the maximum timeout for pushing metrics to the provided interval between pushes
This should guarantee that metrics are pushed regularly with the provided interval.
If the remote storage cannot keep up with push frequency, then timeout errors will be logged.
2022-07-21 18:21:11 +03:00
Aliaksandr Valialkin
6cf96d45a0
add functionality for periodic pushing metrics to remote storage via InitPush* 2022-07-20 16:53:12 +03:00