Document the expected behavior of the 'Beater' interface #1234
Description
The contract around the Beater interface is not well documented which is problematic since third-parties implement it for their own Beats.
This has led to slightly different implementations among our Beats.
The Beater.Cleanup()
can be called before the Beater.Run()
finishes. This issue occurs if Beater.Stop()
is implemented as a non-blocking method (i.e. signal to stop, but don’t wait). In this case Stop()
is called and returns immediately and then Cleanup()
is called. Meanwhile Beater.Run()
has not exited yet.
Another related issue is that the process exits before Beater.Run()
completes. This is problematic if any state needs to be flushed to disk before the process exits.
All Beats except Filebeat implement the Stop()
method as a non-blocking method.