mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
Removes global defaultAuthToken, since it's no longer needed. It was added as fallback for 'remoteWrite.multitenantURL' feature. This feature was deprecated at v1.102 version and removed. Updates newRemoteWriteCtxs function, it shouldn't accept auth.Token no longer. This was also a part of remove feature. Signed-off-by: f41gh7 <nik@victoriametrics.com>
This commit is contained in:
parent
430163d01a
commit
036f33de48
1 changed files with 2 additions and 15 deletions
|
@ -99,9 +99,6 @@ var (
|
||||||
// rwctxsGlobal contains statically populated entries when -remoteWrite.url is specified.
|
// rwctxsGlobal contains statically populated entries when -remoteWrite.url is specified.
|
||||||
rwctxsGlobal []*remoteWriteCtx
|
rwctxsGlobal []*remoteWriteCtx
|
||||||
|
|
||||||
// Data without tenant id is written to defaultAuthToken if -enableMultitenantHandlers is specified.
|
|
||||||
defaultAuthToken = &auth.Token{}
|
|
||||||
|
|
||||||
// ErrQueueFullHTTPRetry must be returned when TryPush() returns false.
|
// ErrQueueFullHTTPRetry must be returned when TryPush() returns false.
|
||||||
ErrQueueFullHTTPRetry = &httpserver.ErrorWithStatusCode{
|
ErrQueueFullHTTPRetry = &httpserver.ErrorWithStatusCode{
|
||||||
Err: fmt.Errorf("remote storage systems cannot keep up with the data ingestion rate; retry the request later " +
|
Err: fmt.Errorf("remote storage systems cannot keep up with the data ingestion rate; retry the request later " +
|
||||||
|
@ -209,7 +206,7 @@ func Init() {
|
||||||
|
|
||||||
initStreamAggrConfigGlobal()
|
initStreamAggrConfigGlobal()
|
||||||
|
|
||||||
rwctxsGlobal = newRemoteWriteCtxs(nil, *remoteWriteURLs)
|
rwctxsGlobal = newRemoteWriteCtxs(*remoteWriteURLs)
|
||||||
|
|
||||||
disableOnDiskQueues := []bool(*disableOnDiskQueue)
|
disableOnDiskQueues := []bool(*disableOnDiskQueue)
|
||||||
disableOnDiskQueueAny = slices.Contains(disableOnDiskQueues, true)
|
disableOnDiskQueueAny = slices.Contains(disableOnDiskQueues, true)
|
||||||
|
@ -294,7 +291,7 @@ var (
|
||||||
relabelConfigTimestamp = metrics.NewCounter(`vmagent_relabel_config_last_reload_success_timestamp_seconds`)
|
relabelConfigTimestamp = metrics.NewCounter(`vmagent_relabel_config_last_reload_success_timestamp_seconds`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRemoteWriteCtxs(at *auth.Token, urls []string) []*remoteWriteCtx {
|
func newRemoteWriteCtxs(urls []string) []*remoteWriteCtx {
|
||||||
if len(urls) == 0 {
|
if len(urls) == 0 {
|
||||||
logger.Panicf("BUG: urls must be non-empty")
|
logger.Panicf("BUG: urls must be non-empty")
|
||||||
}
|
}
|
||||||
|
@ -316,11 +313,6 @@ func newRemoteWriteCtxs(at *auth.Token, urls []string) []*remoteWriteCtx {
|
||||||
logger.Fatalf("invalid -remoteWrite.url=%q: %s", remoteWriteURL, err)
|
logger.Fatalf("invalid -remoteWrite.url=%q: %s", remoteWriteURL, err)
|
||||||
}
|
}
|
||||||
sanitizedURL := fmt.Sprintf("%d:secret-url", i+1)
|
sanitizedURL := fmt.Sprintf("%d:secret-url", i+1)
|
||||||
if at != nil {
|
|
||||||
// Construct full remote_write url for the given tenant according to https://docs.victoriametrics.com/cluster-victoriametrics/#url-format
|
|
||||||
remoteWriteURL.Path = fmt.Sprintf("%s/insert/%d:%d/prometheus/api/v1/write", remoteWriteURL.Path, at.AccountID, at.ProjectID)
|
|
||||||
sanitizedURL = fmt.Sprintf("%s:%d:%d", sanitizedURL, at.AccountID, at.ProjectID)
|
|
||||||
}
|
|
||||||
if *showRemoteWriteURL {
|
if *showRemoteWriteURL {
|
||||||
sanitizedURL = fmt.Sprintf("%d:%s", i+1, remoteWriteURL)
|
sanitizedURL = fmt.Sprintf("%d:%s", i+1, remoteWriteURL)
|
||||||
}
|
}
|
||||||
|
@ -411,11 +403,6 @@ func TryPush(at *auth.Token, wr *prompbmarshal.WriteRequest) bool {
|
||||||
func tryPush(at *auth.Token, wr *prompbmarshal.WriteRequest, forceDropSamplesOnFailure bool) bool {
|
func tryPush(at *auth.Token, wr *prompbmarshal.WriteRequest, forceDropSamplesOnFailure bool) bool {
|
||||||
tss := wr.Timeseries
|
tss := wr.Timeseries
|
||||||
|
|
||||||
if at == nil && MultitenancyEnabled() {
|
|
||||||
// Write data to default tenant if at isn't set when multitenancy is enabled.
|
|
||||||
at = defaultAuthToken
|
|
||||||
}
|
|
||||||
|
|
||||||
var tenantRctx *relabelCtx
|
var tenantRctx *relabelCtx
|
||||||
if at != nil {
|
if at != nil {
|
||||||
// Convert at to (vm_account_id, vm_project_id) labels.
|
// Convert at to (vm_account_id, vm_project_id) labels.
|
||||||
|
|
Loading…
Reference in a new issue