Add call to optional Init function for all plugins (#5899)
This commit is contained in:
@@ -52,6 +52,10 @@ var sampleConfig = `
|
||||
drop_original = false
|
||||
`
|
||||
|
||||
func (m *Min) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Min) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ func (s *Simple) SampleConfig() string {
|
||||
`
|
||||
}
|
||||
|
||||
func (s *Simple) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Simple) Gather(acc telegraf.Accumulator) error {
|
||||
if s.Ok {
|
||||
acc.AddFields("state", map[string]interface{}{"value": "pretty good"}, nil)
|
||||
|
||||
@@ -43,6 +43,10 @@ func (s *Simple) SampleConfig() string {
|
||||
`
|
||||
}
|
||||
|
||||
func (s *Simple) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Simple) Connect() error {
|
||||
// Make a connection to the URL here
|
||||
return nil
|
||||
|
||||
@@ -46,6 +46,10 @@ func (p *Printer) Description() string {
|
||||
return "Print all metrics that pass through this filter."
|
||||
}
|
||||
|
||||
func (p *Printer) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Printer) Apply(in ...telegraf.Metric) []telegraf.Metric {
|
||||
for _, metric := range in {
|
||||
fmt.Println(metric.String())
|
||||
|
||||
Reference in New Issue
Block a user