Commit Graph

15 Commits

Author SHA1 Message Date
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 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
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