-
Notifications
You must be signed in to change notification settings - Fork 106
/tags/delByQuery: support for archiving metrics, not just deletion #1978
Conversation
can you update the |
deleted, err := s.MetricIndex.DeleteTagged(request.OrgId, query) | ||
return len(deleted), err | ||
} | ||
matched, _ := s.MetricIndex.FindTerms(request.OrgId, []string{}, query) | ||
return int(matched), nil | ||
return 0, fmt.Errorf("Unknown delete method '%s'", request.Method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure the model validation already takes care of this case. but anyway, doesn't hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model validation takes care of this when this code and the validation code agree. This is just defensive handling in case these code sections accidentally get out of sync.
@@ -162,14 +162,16 @@ type IndexTagDelByQuery struct { | |||
OrgId uint32 `json:"orgId" binding:"Required"` | |||
Expr []string `json:"expressions" binding:"Required"` | |||
OlderThan int64 `json:"olderThan" form:"olderThan"` | |||
Execute bool `json:execute binding:"Default(false)"` | |||
Execute bool `json:"execute" binding:"Default(false)"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oopsie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we need another static validator to catch typos like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
just the docs tweak and this is good to merge
Thanks @Dieterbe! |
Resolves #1977