Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublishChannels ¶
PublishChannels publishes the events read from each channel to the given publisher client. If the publisher client blocks for any reason then events will not be read from the given channels.
This method blocks until all of the channels have been closed and are fully read. To stop the method immediately, close the channels and close the publisher client to ensure that publishing does not block. This may result is some events being discarded.
Types ¶
type EventBuilder ¶
type EventBuilder struct { ModuleName string MetricSetName string Host string StartTime time.Time FetchDuration time.Duration Event common.MapStr // contains filtered or unexported fields }
EventBuilder is used for building MetricSet events. MetricSets generate a data in the form of a common.MapStr. This builder transforms that data into a complete event and applies any Module-level filtering.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is used to register and reload modules
func NewFactory ¶
NewFactory creates new Reloader instance for the given config
type Runner ¶
type Runner interface { // Start starts the Module. If Start is called more than once, only the // first will start the Module. Start() // Stop stops the Module and waits for module's MetricSets to exit. The // publisher.Client will be closed by Stop. If Stop is called more than // once, only the first stop the Module and wait for it to exit. Stop() // Added to be consistent with cfgfile.Runner ID() uint64 }
Runner is a facade for a Wrapper that provides a simple interface for starting and stopping a Module.
Example ¶
ExampleRunner demonstrates how to use Runner to start and stop a module.
Output:
type Wrapper ¶
Wrapper contains the Module and the private data associated with running the Module and its MetricSets.
Use NewWrapper or NewWrappers to construct new Wrappers.
Example ¶
ExampleWrapper demonstrates how to create a single Wrapper from configuration, start the module, and consume events generated by the module.
Output: { "@timestamp": "2016-05-10T23:27:58.485Z", "_event_metadata": { "Fields": null, "FieldsUnderRoot": false, "Tags": null }, "fake": { "status": { "metric": 1 } }, "metricset": { "module": "fake", "name": "status", "rtt": 111 }, "type": "metricsets" }
func NewWrapper ¶
NewWrapper create a new Module and its associated MetricSets based on the given configuration. It constructs the supporting filters and stores them in the Wrapper.
func NewWrappers ¶
NewWrappers creates new Modules and their associated MetricSets based on the given configuration. It constructs the supporting filters and stores them all in a Wrapper.
func (*Wrapper) Hash ¶
Hash returns the hash value of the module wrapper This allows to check if two modules are the same / have the same config
func (*Wrapper) Start ¶
Start starts the Module's MetricSet workers which are responsible for fetching metrics. The workers will continue to periodically fetch until the done channel is closed. When the done channel is closed all MetricSet workers will stop and the returned output channel will be closed.
The returned channel is buffered with a length one one. It must drained to prevent blocking the operation of the MetricSets.
Start should be called only once in the life of a Wrapper.