Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseEvent ¶
type BaseEvent struct { Ts int64 `json:"ts"` Kind string `json:"name"` Version string `json:"version,omitempty"` Endpoints map[string]string `json:"endpoints,omitempty"` }
BaseEvent is an event that is sent when the pipeline has been started or exited
func NewBootEvent ¶
NewBootEvent (surprisingly) creates a new baseEvent
func NewExitEvent ¶
NewExitEvent (surprisingly) creates a new BaseEvent
type Emitter ¶
type Emitter interface { Start() Init(chan Event) Stop() }
Emitter types are used by the transporter pipeline to consume events from a pipeline's event channel and process them. Start() will start the emitter and being consuming events Init() serves to set the Emitter's listening channel Stop() stops the event loop and releases any resources. Stop is expected to shut down the process cleanly, the pipeline process will block until Stop() returns
type ErrorEvent ¶
type ErrorEvent struct { Ts int64 `json:"ts"` Kind string `json:"name"` Path string `json:"path"` // Record is the document (if any) that was in progress when the error occured Record interface{} `json:"record,omitempty"` // Message is the error message as a string Message string `json:"message,omitempty"` }
ErrorEvent is an event that indicates an error occured during the processing of a pipeline
func NewErrorEvent ¶
func NewErrorEvent(ts int64, path string, record interface{}, message string) *ErrorEvent
NewErrorEvent are events sent to indicate a problem processing on one of the nodes
func (*ErrorEvent) Emit ¶
func (e *ErrorEvent) Emit() ([]byte, error)
Emit prepares the event to be emitted and marshalls the event into an json
type Event ¶
Event is an interface that describes data which is produced periodically by the running transporter.
Events come in multiple kinds. baseEvents are emitted when the transporter starts and stops, metricsEvents are emittied by each pipe and include a measure of how many messages have been processed
type HTTPPostEmitter ¶
type HTTPPostEmitter struct {
// contains filtered or unexported fields
}
HTTPPostEmitter listens on the event channel and posts the events to an http server Events are serialized into json, and sent via a POST request to the given Uri http errors are logged as warnings to the console, and won't stop the Emitter
func NewHTTPPostEmitter ¶
func NewHTTPPostEmitter(uri, key, pid string) *HTTPPostEmitter
NewHTTPPostEmitter creates a new HTTPPostEmitter
func (*HTTPPostEmitter) Init ¶
func (e *HTTPPostEmitter) Init(ch chan Event)
Init sets the event channel
func (*HTTPPostEmitter) Stop ¶
func (e *HTTPPostEmitter) Stop()
Stop sends a stop signal and waits for the inflight posts to complete before exiting
type LogEmitter ¶
type LogEmitter struct {
// contains filtered or unexported fields
}
LogEmitter constructs a LogEmitter to use with a transporter pipeline. A LogEmitter listens on the event channel and uses go's log package to emit the event, eg.
2014/11/28 16:56:58 boot map[source:mongo out:mongo] 2014/11/28 16:56:58 metrics source recordsIn: 0, recordsOut: 203 2014/11/28 16:56:58 exit 2014/11/28 16:56:58 metrics source/out recordsIn: 203, recordsOut: 0
type MetricsEvent ¶
type MetricsEvent struct { Ts int64 `json:"ts"` Kind string `json:"name"` Path string `json:"path"` // Records indicated the total number of documents that have been transmitted Records int `json:"records"` }
MetricsEvent is an event used to indicated progress.
func NewMetricsEvent ¶
func NewMetricsEvent(ts int64, path string, records int) *MetricsEvent
NewMetricsEvent creates a new metrics event
func (*MetricsEvent) Emit ¶
func (e *MetricsEvent) Emit() ([]byte, error)
Emit prepares the event to be emitted and marshalls the event into an json
func (*MetricsEvent) String ¶
func (e *MetricsEvent) String() string
type NoopEmitter ¶
type NoopEmitter struct {
// contains filtered or unexported fields
}
NoopEmitter consumes the events from the listening channel and does nothing with them this is useful for cli utilities that dump output to stdout in any case, and don't want to clutter the program's output with metrics
func NewNoopEmitter ¶
func NewNoopEmitter() *NoopEmitter
NewNoopEmitter constructs a NoopEmitter to use with a transporter pipeline. a NoopEmitter consumes the events from the listening channel and does nothing with them this is useful for cli utilities that dump output to stdout in any case, and don't want to clutter the program's output with metrics