Skip to content

Commit 956d4bb

Browse files
kruskallbelimawr
andauthored
fix(metricbeat): log messages before out channel is closed (#47659)
The wrapper signals completion to the caller via the output channel but a log message is currently emitted after the channel has been closed. We should move all log statements to occur before closing the channel, ensuring no messages are logged post-closure. Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
1 parent 82d8581 commit 956d4bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

metricbeat/mb/module/wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ func (mw *Wrapper) Start(done <-chan struct{}) <-chan beat.Event {
180180
// Close the output channel when all writers to the channel have stopped.
181181
go func() {
182182
wg.Wait()
183-
close(out)
184183
mw.logger.Named("module").Debugf("Stopped %s", mw)
184+
close(out)
185185
}()
186186

187187
return out

0 commit comments

Comments
 (0)