-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.go
39 lines (29 loc) · 1.08 KB
/
input.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package telegraf
import "context"
type Input interface {
// SampleConfig returns the default configuration of the Input
SampleConfig() string
// Description returns a one-sentence description on the Input
Description() string
// Gather takes in an accumulator and adds the metrics that the Input
// gathers. This is called every "interval"
Gather(Accumulator) error
}
type ServiceInput interface {
Input
// Start the ServiceInput. The Accumulator may be retained and used until
// Stop returns.
Start(Accumulator) error
// Stop stops the services and closes any necessary channels and connections
Stop()
}
//ServiceInputWithContext -- greatdolphin 20200520
type ServiceInputWithContext interface {
Input
// Start the ServiceInput. The Accumulator may be retained and used until
// Stop returns.
// context is the invoker's context which is used to cancel ServiceInput by invoker
StartContext(context.Context, Accumulator) error
// Stop stops the services and closes any necessary channels and connections
Stop()
}