diff --git a/internal/telemetry/event/tag.go b/internal/telemetry/event/tag.go index 1fd271af79..7d7a34c0f6 100644 --- a/internal/telemetry/event/tag.go +++ b/internal/telemetry/event/tag.go @@ -19,8 +19,6 @@ type Tag struct { // TagMap is the interface to a collection of Tags indexed by key. type TagMap interface { - // IsEmpty returns true if the map holds no tags. - IsEmpty() bool // Find returns the tag that matches the supplied key. Find(key interface{}) Tag } @@ -200,10 +198,6 @@ func (l tagMap) Find(key interface{}) Tag { return Tag{} } -func (l tagMap) IsEmpty() bool { - return len(l.tags) == 0 -} - func (c tagMapChain) Find(key interface{}) Tag { for _, src := range c.maps { tag := src.Find(key) @@ -214,15 +208,6 @@ func (c tagMapChain) Find(key interface{}) Tag { return Tag{} } -func (c tagMapChain) IsEmpty() bool { - for _, src := range c.maps { - if !src.IsEmpty() { - return false - } - } - return true -} - func NewTagIterator(tags ...Tag) TagIterator { if len(tags) == 0 { return TagIterator{} diff --git a/internal/telemetry/event/tag_test.go b/internal/telemetry/event/tag_test.go index 6d7539ff6c..e5d7e471b6 100644 --- a/internal/telemetry/event/tag_test.go +++ b/internal/telemetry/event/tag_test.go @@ -172,16 +172,14 @@ func TestTagChain(t *testing.T) { func TestTagMap(t *testing.T) { for _, test := range []struct { - name string - tags []event.Tag - keys []event.Key - expect string - isEmpty bool + name string + tags []event.Tag + keys []event.Key + expect string }{{ - name: "no tags", - keys: []event.Key{AKey}, - expect: `nil`, - isEmpty: true, + name: "no tags", + keys: []event.Key{AKey}, + expect: `nil`, }, { name: "match A", tags: all, @@ -220,9 +218,6 @@ func TestTagMap(t *testing.T) { }} { t.Run(test.name, func(t *testing.T) { tagMap := event.NewTagMap(test.tags...) - if tagMap.IsEmpty() != test.isEmpty { - t.Errorf("IsEmpty gave %v want %v", tagMap.IsEmpty(), test.isEmpty) - } got := printTagMap(tagMap, test.keys) if got != test.expect { t.Errorf("got %q want %q", got, test.expect) @@ -233,27 +228,24 @@ func TestTagMap(t *testing.T) { func TestTagMapMerge(t *testing.T) { for _, test := range []struct { - name string - tags [][]event.Tag - keys []event.Key - expect string - isEmpty bool + name string + tags [][]event.Tag + keys []event.Key + expect string }{{ - name: "no maps", - keys: []event.Key{AKey}, - expect: `nil`, - isEmpty: true, + name: "no maps", + keys: []event.Key{AKey}, + expect: `nil`, }, { name: "one map", tags: [][]event.Tag{all}, keys: []event.Key{AKey}, expect: `A="a"`, }, { - name: "invalid map", - tags: [][]event.Tag{{}}, - keys: []event.Key{AKey}, - expect: `nil`, - isEmpty: true, + name: "invalid map", + tags: [][]event.Tag{{}}, + keys: []event.Key{AKey}, + expect: `nil`, }, { name: "two maps", tags: [][]event.Tag{{B, C}, {A}}, @@ -281,9 +273,6 @@ func TestTagMapMerge(t *testing.T) { maps[i] = event.NewTagMap(v...) } tagMap := event.MergeTagMaps(maps...) - if tagMap.IsEmpty() != test.isEmpty { - t.Errorf("IsEmpty gave %v want %v", tagMap.IsEmpty(), test.isEmpty) - } got := printTagMap(tagMap, test.keys) if got != test.expect { t.Errorf("got %q want %q", got, test.expect)