Skip to content

Commit

Permalink
sender unregisters its own metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkenny committed Jan 20, 2024
1 parent 4515751 commit a1264ce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
5 changes: 0 additions & 5 deletions lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,31 +89,26 @@ func TestNewSenderWithDeviceNameLeaks(t *testing.T) {
assert.NoError(err)
assert.NotNil(s)
s.Stop(time.Second)
s.Metrics.Unregister()

s, err = libkflow.NewSenderWithDeviceName(device.Name, errors, config)
assert.NoError(err)
assert.NotNil(s)
s.Stop(time.Second)
s.Metrics.Unregister()

s, err = libkflow.NewSenderWithDeviceName(device.Name, errors, config)
assert.NoError(err)
assert.NotNil(s)
s.Stop(time.Second)
s.Metrics.Unregister()

s, err = libkflow.NewSenderWithDeviceName(device.Name, errors, config)
assert.NoError(err)
assert.NotNil(s)
s.Stop(time.Second)
s.Metrics.Unregister()

s, err = libkflow.NewSenderWithDeviceName(device.Name, errors, config)
assert.NoError(err)
assert.NotNil(s)
s.Stop(time.Second)
s.Metrics.Unregister()

server.Close()

Expand Down
1 change: 1 addition & 0 deletions send.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func (s *Sender) monitor() {
s.workers.Wait()
s.ticker.Stop()
s.tickerCancelFunc()
s.Metrics.Unregister()
s.exit <- struct{}{}
log.Debugf("sender stopped")
return
Expand Down

0 comments on commit a1264ce

Please sign in to comment.