mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
app/vmagent: allow setting multiple identical -remoteWrite.url
values
This may be useful when each url is authenticated via different `-remoteWrite.basicAuth.username`. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/755
This commit is contained in:
parent
62fde80490
commit
ca856284e4
1 changed files with 2 additions and 2 deletions
|
@ -85,7 +85,7 @@ func Init() {
|
||||||
for i, remoteWriteURL := range *remoteWriteURLs {
|
for i, remoteWriteURL := range *remoteWriteURLs {
|
||||||
urlLabelValue := fmt.Sprintf("secret-url-%d", i+1)
|
urlLabelValue := fmt.Sprintf("secret-url-%d", i+1)
|
||||||
if *showRemoteWriteURL {
|
if *showRemoteWriteURL {
|
||||||
urlLabelValue = remoteWriteURL
|
urlLabelValue = fmt.Sprintf("%d:%s", i+1, remoteWriteURL)
|
||||||
}
|
}
|
||||||
rwctx := newRemoteWriteCtx(i, remoteWriteURL, maxInmemoryBlocks, urlLabelValue)
|
rwctx := newRemoteWriteCtx(i, remoteWriteURL, maxInmemoryBlocks, urlLabelValue)
|
||||||
rwctxs = append(rwctxs, rwctx)
|
rwctxs = append(rwctxs, rwctx)
|
||||||
|
@ -192,7 +192,7 @@ type remoteWriteCtx struct {
|
||||||
|
|
||||||
func newRemoteWriteCtx(argIdx int, remoteWriteURL string, maxInmemoryBlocks int, urlLabelValue string) *remoteWriteCtx {
|
func newRemoteWriteCtx(argIdx int, remoteWriteURL string, maxInmemoryBlocks int, urlLabelValue string) *remoteWriteCtx {
|
||||||
h := xxhash.Sum64([]byte(remoteWriteURL))
|
h := xxhash.Sum64([]byte(remoteWriteURL))
|
||||||
path := fmt.Sprintf("%s/persistent-queue/%016X", *tmpDataPath, h)
|
path := fmt.Sprintf("%s/persistent-queue/%d_%016X", *tmpDataPath, argIdx+1, h)
|
||||||
fq := persistentqueue.MustOpenFastQueue(path, remoteWriteURL, maxInmemoryBlocks, maxPendingBytesPerURL.N)
|
fq := persistentqueue.MustOpenFastQueue(path, remoteWriteURL, maxInmemoryBlocks, maxPendingBytesPerURL.N)
|
||||||
_ = metrics.GetOrCreateGauge(fmt.Sprintf(`vmagent_remotewrite_pending_data_bytes{path=%q, url=%q}`, path, urlLabelValue), func() float64 {
|
_ = metrics.GetOrCreateGauge(fmt.Sprintf(`vmagent_remotewrite_pending_data_bytes{path=%q, url=%q}`, path, urlLabelValue), func() float64 {
|
||||||
return float64(fq.GetPendingBytes())
|
return float64(fq.GetPendingBytes())
|
||||||
|
|
Loading…
Reference in a new issue