mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
lib/storage: properly handle the case when key="__name__" is passed to MetricName.AddTag*
This commit is contained in:
parent
9c5cd5a6c5
commit
7599e5c835
@ -203,6 +203,10 @@ func (mn *MetricName) CopyFrom(src *MetricName) {
|
||||
|
||||
// AddTag adds new tag to mn with the given key and value.
|
||||
func (mn *MetricName) AddTag(key, value string) {
|
||||
if key == string(metricGroupTagKey) {
|
||||
mn.MetricGroup = append(mn.MetricGroup, value...)
|
||||
return
|
||||
}
|
||||
tag := mn.addNextTag()
|
||||
tag.Key = append(tag.Key[:0], key...)
|
||||
tag.Value = append(tag.Value[:0], value...)
|
||||
@ -210,6 +214,10 @@ func (mn *MetricName) AddTag(key, value string) {
|
||||
|
||||
// AddTagBytes adds new tag to mn with the given key and value.
|
||||
func (mn *MetricName) AddTagBytes(key, value []byte) {
|
||||
if string(key) == string(metricGroupTagKey) {
|
||||
mn.MetricGroup = append(mn.MetricGroup, value...)
|
||||
return
|
||||
}
|
||||
tag := mn.addNextTag()
|
||||
tag.Key = append(tag.Key[:0], key...)
|
||||
tag.Value = append(tag.Value[:0], value...)
|
||||
|
Loading…
Reference in New Issue
Block a user