Skip to content

Commit

Permalink
Fix duplicate tags when overriding tag (influxdata#4056)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored and arkady-emelyanov committed May 18, 2018
1 parent 7c34b4c commit c3d8c34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (m *metric) AddTag(key, value string) {

if key == tag.Key {
tag.Value = value
return
}

m.tags = append(m.tags, nil)
Expand Down
1 change: 1 addition & 0 deletions metric/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func TestAddTagOverwrites(t *testing.T) {
value, ok := m.GetTag("host")
require.True(t, ok)
require.Equal(t, "example.org", value)
require.Equal(t, 1, len(m.TagList()))
}

func TestRemoveTagNoEffectOnMissingTags(t *testing.T) {
Expand Down

0 comments on commit c3d8c34

Please sign in to comment.