sinks

package
v0.3.1-0...-cfe5a4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventData

type EventData struct {
	Verb     string    `json:"verb"`
	Event    *v1.Event `json:"event"`
	OldEvent *v1.Event `json:"old_event,omitempty"`
}

EventData encodes an eventrouter event and previous event, with a verb for whether the event is created or updated.

func NewEventData

func NewEventData(eNew *v1.Event, eOld *v1.Event) EventData

NewEventData constructs an EventData struct from an old and new event, setting the verb accordingly

func (*EventData) WriteRFC5424

func (e *EventData) WriteRFC5424(w io.Writer) (int64, error)

WriteRFC5424 writes the current event data to the given io.Writer using RFC5424 (syslog over TCP) syntax.

type EventSinkInterface

type EventSinkInterface interface {
	UpdateEvents(eNew *v1.Event, eOld *v1.Event)
}

EventSinkInterface is the interface used to shunt events

func ManufactureSink

func ManufactureSink() (e EventSinkInterface)

ManufactureSink will manufacture a sink according to viper configs TODO: Determine if it should return an array of sinks

func NewGlogSink

func NewGlogSink() EventSinkInterface

NewGlogSink will create a new

func NewKafkaSink

func NewKafkaSink(brokers []string, topic string, async bool, retryMax int) (EventSinkInterface, error)

NewKafkaSinkSink will create a new KafkaSink with default options, returned as an EventSinkInterface

func NewStdoutSink

func NewStdoutSink() EventSinkInterface

NewStdoutSink will create a new StdoutSink with default options, returned as an EventSinkInterface

type GlogSink

type GlogSink struct {
}

GlogSink is the most basic sink Useful when you already have ELK/EFK Stack

func (*GlogSink) UpdateEvents

func (gs *GlogSink) UpdateEvents(eNew *v1.Event, eOld *v1.Event)

UpdateEvents implements the EventSinkInterface

type HTTPSink

type HTTPSink struct {
	SinkURL string
	// contains filtered or unexported fields
}

HTTPSink wraps an HTTP endpoint that messages should be sent to.

func NewHTTPSink

func NewHTTPSink(sinkURL string, overflow bool, bufferSize int) *HTTPSink

NewHTTPSink constructs a new HTTPSink given a sink URL and buffer size

func (*HTTPSink) Run

func (h *HTTPSink) Run(stopCh <-chan bool)

Run sits in a loop, waiting for data to come in through h.eventCh, and forwarding them to the HTTP sink. If multiple events have happened between loop iterations, it puts all of them in one request instead of making a single request per event.

func (*HTTPSink) UpdateEvents

func (h *HTTPSink) UpdateEvents(eNew *v1.Event, eOld *v1.Event)

UpdateEvents implements the EventSinkInterface. It really just writes the event data to the event OverflowingChannel, which should never block. Messages that are buffered beyond the bufferSize specified for this HTTPSink are discarded.

type KafkaSink

type KafkaSink struct {
	Topic string
	// contains filtered or unexported fields
}

KafkaSink implements the EventSinkInterface

func (*KafkaSink) UpdateEvents

func (ks *KafkaSink) UpdateEvents(eNew *v1.Event, eOld *v1.Event)

UpdateEvents implements EventSinkInterface.UpdateEvents

type StdoutSink

type StdoutSink struct {
}

StdoutSink is the other basic sink By default, Fluentd/ElasticSearch won't index glog formatted lines By logging raw JSON to stdout, we will get automated indexing which can be queried in Kibana.

func (*StdoutSink) UpdateEvents

func (gs *StdoutSink) UpdateEvents(eNew *v1.Event, eOld *v1.Event)

UpdateEvents implements the EventSinkInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL