mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
lib/storage: properly handle the case when key="__name__" is passed to MetricName.AddTag*
This commit is contained in:
parent
64e2d66014
commit
d12c4914f0
@ -196,6 +196,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...)
|
||||
@ -203,6 +207,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