mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
app/vmagent/remotewrite: follow-up for e3a756d82869f8c357b072f6e635ebfc7d65dd2c
- Document the fix - Move the detection of VictoriaMetrics remoteWrite protocol from client.init() to newHTTPClient() This simplifies the fix to the following diff: diff --git a/app/vmagent/remotewrite/client.go b/app/vmagent/remotewrite/client.go index 099899c19..70b904af4 100644 --- a/app/vmagent/remotewrite/client.go +++ b/app/vmagent/remotewrite/client.go @@ -151,10 +151,6 @@ func newHTTPClient(argIdx int, remoteWriteURL, sanitizedURL string, fq *persiste } c.sendBlock = c.sendBlockHTTP - return c -} - -func (c *client) init(argIdx, concurrency int, sanitizedURL string) { useVMProto := forceVMProto.GetOptionalArg(argIdx) usePromProto := forcePromProto.GetOptionalArg(argIdx) if useVMProto && usePromProto { @@ -173,6 +169,10 @@ func (c *client) init(argIdx, concurrency int, sanitizedURL string) { } c.useVMProto = useVMProto + return c +} + +func (c *client) init(argIdx, concurrency int, sanitizedURL string) {
This commit is contained in:
parent
2cf6797a24
commit
b60594a548
@ -147,19 +147,12 @@ func newHTTPClient(argIdx int, remoteWriteURL, sanitizedURL string, fq *persiste
|
|||||||
}
|
}
|
||||||
c.sendBlock = c.sendBlockHTTP
|
c.sendBlock = c.sendBlockHTTP
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) init(argIdx, concurrency int, sanitizedURL string) {
|
|
||||||
// custom proto encoding is supported only over http connections
|
|
||||||
isHTTPClient := c.hc != nil
|
|
||||||
|
|
||||||
useVMProto := forceVMProto.GetOptionalArg(argIdx)
|
useVMProto := forceVMProto.GetOptionalArg(argIdx)
|
||||||
usePromProto := forcePromProto.GetOptionalArg(argIdx)
|
usePromProto := forcePromProto.GetOptionalArg(argIdx)
|
||||||
if useVMProto && usePromProto {
|
if useVMProto && usePromProto {
|
||||||
logger.Fatalf("-remoteWrite.useVMProto and -remoteWrite.usePromProto cannot be set simultaneously for -remoteWrite.url=%s", sanitizedURL)
|
logger.Fatalf("-remoteWrite.useVMProto and -remoteWrite.usePromProto cannot be set simultaneously for -remoteWrite.url=%s", sanitizedURL)
|
||||||
}
|
}
|
||||||
if isHTTPClient && !useVMProto && !usePromProto {
|
if !useVMProto && !usePromProto {
|
||||||
// Auto-detect whether the remote storage supports VictoriaMetrics remote write protocol.
|
// Auto-detect whether the remote storage supports VictoriaMetrics remote write protocol.
|
||||||
doRequest := func(url string) (*http.Response, error) {
|
doRequest := func(url string) (*http.Response, error) {
|
||||||
return c.doRequest(url, nil)
|
return c.doRequest(url, nil)
|
||||||
@ -170,10 +163,12 @@ func (c *client) init(argIdx, concurrency int, sanitizedURL string) {
|
|||||||
"See https://docs.victoriametrics.com/vmagent.html#victoriametrics-remote-write-protocol", sanitizedURL)
|
"See https://docs.victoriametrics.com/vmagent.html#victoriametrics-remote-write-protocol", sanitizedURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isHTTPClient {
|
c.useVMProto = useVMProto
|
||||||
c.useVMProto = useVMProto
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *client) init(argIdx, concurrency int, sanitizedURL string) {
|
||||||
if bytesPerSec := rateLimit.GetOptionalArgOrDefault(argIdx, 0); bytesPerSec > 0 {
|
if bytesPerSec := rateLimit.GetOptionalArgOrDefault(argIdx, 0); bytesPerSec > 0 {
|
||||||
logger.Infof("applying %d bytes per second rate limit for -remoteWrite.url=%q", bytesPerSec, sanitizedURL)
|
logger.Infof("applying %d bytes per second rate limit for -remoteWrite.url=%q", bytesPerSec, sanitizedURL)
|
||||||
c.rl.perSecondLimit = int64(bytesPerSec)
|
c.rl.perSecondLimit = int64(bytesPerSec)
|
||||||
|
@ -19,6 +19,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
|||||||
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): `vmctl` `vm-native` mode now splits the migration process on per-metric basis. This allows to migrate metrics one-by-one according to the specified filter. This change allows to retry export/import requests for a specific metric and provides a better understanding of the migration progress. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3600).
|
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): `vmctl` `vm-native` mode now splits the migration process on per-metric basis. This allows to migrate metrics one-by-one according to the specified filter. This change allows to retry export/import requests for a specific metric and provides a better understanding of the migration progress. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3600).
|
||||||
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): `vmctl` `vm-native` mode now supports `--vm-native-src-headers` and `--vm-native-dst-headers` which defines headers to send with each request to the corresponding source address. Thanks, @baconmania, for the pull request. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3906).
|
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): `vmctl` `vm-native` mode now supports `--vm-native-src-headers` and `--vm-native-dst-headers` which defines headers to send with each request to the corresponding source address. Thanks, @baconmania, for the pull request. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3906).
|
||||||
|
|
||||||
|
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): fix panic when [writing data to Kafka](https://docs.victoriametrics.com/vmagent.html#writing-metrics-to-kafka). The panic has been introduced in [v1.88.0](https://docs.victoriametrics.com/CHANGELOG.html#v1880).
|
||||||
* BUGFIX: prevent from possible panic during [background merge process](https://docs.victoriametrics.com/#storage). It may occur in rare case and was introduced at [v1.85.0](https://docs.victoriametrics.com/CHANGELOG.html#v1850) when implementing [this feature](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3337).
|
* BUGFIX: prevent from possible panic during [background merge process](https://docs.victoriametrics.com/#storage). It may occur in rare case and was introduced at [v1.85.0](https://docs.victoriametrics.com/CHANGELOG.html#v1850) when implementing [this feature](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3337).
|
||||||
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): stop showing `Please enter a valid Query and execute it` error message on the first load of vmui.
|
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): stop showing `Please enter a valid Query and execute it` error message on the first load of vmui.
|
||||||
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): support old format of URL params. This should make compatible copying URL between vmui of versions or using `Run in VMUI` button in datasource plugin.
|
* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): support old format of URL params. This should make compatible copying URL between vmui of versions or using `Run in VMUI` button in datasource plugin.
|
||||||
|
Loading…
Reference in New Issue
Block a user