Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions filebeat/input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ import (
"github.com/elastic/beats/filebeat/input/file"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/monitoring"
)

var (
inputList = monitoring.NewUniqueList()
)

func init() {
monitoring.NewFunc(monitoring.GetNamespace("state").GetRegistry(), "input", inputList.Report, monitoring.Report)
}

// Input is the interface common to all input
type Input interface {
Run()
Expand Down Expand Up @@ -111,6 +120,7 @@ func (p *Runner) Start() {
}

onceWg.Add(1)
inputList.Add(p.config.Type)
// Add waitgroup to make sure input is finished
go func() {
defer func() {
Expand Down Expand Up @@ -150,6 +160,7 @@ func (p *Runner) Stop() {
// Stop scanning and wait for completion
close(p.done)
p.wg.Wait()
inputList.Remove(p.config.Type)
}

func (p *Runner) stop() {
Expand Down