sinks

package
v0.0.0-...-3ce1eab Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppGroup

type AppGroup struct {
	// contains filtered or unexported fields
}

func NewAppGroup

func NewAppGroup(
	droppedMetric *metricemitter.Counter,
	errorMetric *metricemitter.Counter,
) *AppGroup

func (*AppGroup) AddSink

func (g *AppGroup) AddSink(sink Sink, in chan<- *events.Envelope) bool

func (*AppGroup) BroadcastError

func (g *AppGroup) BroadcastError(msg *events.Envelope)

func (*AppGroup) BroadcastMessage

func (g *AppGroup) BroadcastMessage(msg *events.Envelope)

func (*AppGroup) Exists

func (g *AppGroup) Exists(sink Sink) bool

func (*AppGroup) IsEmpty

func (g *AppGroup) IsEmpty() bool

func (*AppGroup) RecentLogsSink

func (g *AppGroup) RecentLogsSink(id string) *DumpSink

func (*AppGroup) RemoveAllSinks

func (g *AppGroup) RemoveAllSinks()

func (*AppGroup) RemoveSink

func (g *AppGroup) RemoveSink(sink Sink) bool

func (*AppGroup) Sink

func (g *AppGroup) Sink(id string) Sink

type DumpSink

type DumpSink struct {
	// contains filtered or unexported fields
}

func NewDumpSink

func NewDumpSink(
	appId string,
	bufferSize uint32,
	inactivityDuration time.Duration,
	h HealthRegistrar,
) *DumpSink

func (*DumpSink) AppID

func (d *DumpSink) AppID() string

func (*DumpSink) Dump

func (d *DumpSink) Dump() []*events.Envelope

func (*DumpSink) Identifier

func (d *DumpSink) Identifier() string

func (*DumpSink) Run

func (d *DumpSink) Run(inputChan <-chan *events.Envelope)

type EnvelopeSender

type EnvelopeSender interface {
	SendTo(string, *events.Envelope)
}

EnvelopeSender is the interface the MessageRouter uses to send envelopes read from the diode.

type GroupedSinks

type GroupedSinks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGroupedSinks

func NewGroupedSinks(mc MetricClient) *GroupedSinks

func (*GroupedSinks) Broadcast

func (group *GroupedSinks) Broadcast(appId string, msg *events.Envelope)

func (*GroupedSinks) CloseAndDelete

func (group *GroupedSinks) CloseAndDelete(sink Sink) bool

func (*GroupedSinks) DeleteAll

func (group *GroupedSinks) DeleteAll()

func (*GroupedSinks) DumpFor

func (group *GroupedSinks) DumpFor(appId string) *DumpSink

func (*GroupedSinks) RegisterAppSink

func (group *GroupedSinks) RegisterAppSink(in chan<- *events.Envelope, sink Sink) bool

type HealthRegistrar

type HealthRegistrar interface {
	Inc(name string)
	Dec(name string)
}

type MessageRouter

type MessageRouter struct {
	// contains filtered or unexported fields
}

MessageRouter consumes from a diode and sends envelopes to all recipients passed to the NewMessageRouter constructor.

func NewMessageRouter

func NewMessageRouter(e ...EnvelopeSender) *MessageRouter

NewMessageRouter is the preferred means of constructing a MessageRouter.

func (*MessageRouter) Start

func (r *MessageRouter) Start(incomingLog *diodes.ManyToOneEnvelope)

Start begins an infinite loop which reads from the diode and sends any received envelopes to the MessageRouter's senders.

type MetricBatcher

type MetricBatcher interface {
	BatchIncrementCounter(name string)
}

type MetricClient

type MetricClient interface {
	NewCounter(name string, opts ...metricemitter.MetricOption) *metricemitter.Counter
	NewGauge(name, unit string, opts ...metricemitter.MetricOption) *metricemitter.Gauge
}

MetricClient creates new Counter and Gauge metrics to be emitted periodically.

type Sink

type Sink interface {
	AppID() string
	Run(<-chan *events.Envelope)
	Identifier() string
}

type SinkManager

type SinkManager struct {
	// contains filtered or unexported fields
}

SinkManager provides an in memory store of recent logs.

func NewSinkManager

func NewSinkManager(
	maxRetainedLogMessages uint32,
	sinkTimeout time.Duration,
	metricClient MetricClient,
	health HealthRegistrar,
) *SinkManager

NewSinkManager creates a SinkManager.

func (*SinkManager) RecentLogsFor

func (sm *SinkManager) RecentLogsFor(appID string) []*events.Envelope

RecentLogsFor provides a fixed number of logs for an application ID.

func (*SinkManager) RegisterSink

func (sm *SinkManager) RegisterSink(sink Sink) bool

RegisterSink sink adds a new sink for the sink manager to manage.

FIXME This method should be private. Nothing calls it except for private functions in this file.

func (*SinkManager) SendTo

func (sm *SinkManager) SendTo(appID string, msg *events.Envelope)

SendTo sends an envelope to the registered sinks for a specified application ID.

func (*SinkManager) Stop

func (sm *SinkManager) Stop()

Stop terminates the sink manager.

func (*SinkManager) UnregisterSink

func (sm *SinkManager) UnregisterSink(sink Sink)

UnregisterSink removes a particular sink from the sink manager.

FIXME This method should be private. Nothing calls it except for private functions in this file.

type SinkManagerMetrics

type SinkManagerMetrics struct {
	// contains filtered or unexported fields
}

func NewSinkManagerMetrics

func NewSinkManagerMetrics(mc MetricClient) *SinkManagerMetrics

func (*SinkManagerMetrics) Dec

func (s *SinkManagerMetrics) Dec(sink Sink)

func (*SinkManagerMetrics) Inc

func (s *SinkManagerMetrics) Inc(sink Sink)

type SinkWrapper

type SinkWrapper struct {
	InputChan chan<- *events.Envelope
	Sink      Sink
}

Jump to

Keyboard shortcuts

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