mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vminsert: allow parsing tenant id from (#4144)
VictoriaMetrics_ProjectID and VictoriaMetrics_AccountID labels. It should help to migrate for new labels vm_account_id vm_project_id without service downtime
This commit is contained in:
parent
9461d3fdfa
commit
5514b5d552
1 changed files with 9 additions and 3 deletions
|
@ -204,13 +204,19 @@ func (ctx *InsertCtx) GetLocalAuthToken(at *auth.Token) *auth.Token {
|
|||
projectID := uint32(0)
|
||||
tmpLabels := ctx.Labels[:0]
|
||||
for _, label := range ctx.Labels {
|
||||
if string(label.Name) == "vm_account_id" {
|
||||
switch string(label.Name) {
|
||||
case "vm_account_id":
|
||||
accountID = parseUint32(label.Value)
|
||||
continue
|
||||
}
|
||||
if string(label.Name) == "vm_project_id" {
|
||||
case "vm_project_id":
|
||||
projectID = parseUint32(label.Value)
|
||||
continue
|
||||
// do not remove labels from labelSet for backward-compatibility
|
||||
// previous realisation kept it
|
||||
case "VictoriaMetrics_AccountID":
|
||||
accountID = parseUint32(label.Value)
|
||||
case "VictoriaMetrics_ProjectID":
|
||||
projectID = parseUint32(label.Value)
|
||||
}
|
||||
tmpLabels = append(tmpLabels, label)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue