Documentation ¶
Overview ¶
Package data (gocollect) holds the collected data to make it ready for submittal.
Package data (gocollect) holds the collected data to make it ready for submittal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BuiltinCollectors = Collectors{}
BuiltinCollectors holds a list of builtin collectors.
Functions ¶
This section is empty.
Types ¶
type Collected ¶
type Collected interface { // The same as the io.Reader interface; used when posting data // through HTTP. Read(p []byte) (n int, err error) // Get the data as a string. String() string // Return voidness of the data. IsEmpty() bool // Methods that operate on the JSON dictionary. GetString(key string) string BuildString(template string, extra *map[string]string) string // Methods that alter the JSON dictionary. SetString(key string, value string) error }
Collected is the interface to operate on collected data. It molds collected bytes into something that implements HTTP POST method can read. Additionally, it allows alterations of top-level JSON key values.
func EmptyCollected ¶
func EmptyCollected() Collected
EmptyCollected creates a new empty Collected object. Use when there is no data.
func NewCollected ¶
NewCollected creates a new Collected object from the supplied bytes.
type Collector ¶
type Collector struct { // Callable that should return Collected. Run CollectorRun // Optional arguments to callable. RunArgs string // Whether this collector is enabled. IsEnabled bool }
Collector holds instructions how to call a collector.
type CollectorRun ¶
CollectorRun is the function signature to use as the Run function in the Collector struct.
type Collectors ¶
Collectors holds a key/value map of strings/Collector where key is the collector name and value is the Collector info. For shell script collectors, the Callable is the shell exec function, and RunArgs is the file name.
func MergeCollectors ¶
func MergeCollectors(c1 *Collectors, c2 *Collectors) *Collectors
MergeCollectors merges two lists of collectors and returns a new list. The latter list takes precedence.
func (*Collectors) GetRunnable ¶ added in v0.7.4
func (c *Collectors) GetRunnable() (keys []string)
GetRunnable returns all keys that have a runnable/enabled collector in a stable/sorted order. That is, sorted order, but core.id is first.
func (*Collectors) Run ¶
func (c *Collectors) Run(key string) Collected
Run runs/executes the collector and returns the data.