Documentation
¶
Index ¶
Constants ¶
const ( DefaultBufferSize = 4096 DefaultRestartBackoff = 5 * time.Second )
Defaults used when New is given a non-positive value.
Variables ¶
This section is empty.
Functions ¶
func NewPollSource ¶
NewPollSource builds a Source that calls poll every interval and emits whatever it returns. A non-positive interval defaults to one second; a nil poll function is a wiring bug and panics here rather than at the first tick.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector wires sources to sinks. Build it with New, register components before calling Run, then call Run exactly once.
func New ¶
func New(log logr.Logger, bufferSize int, backoff time.Duration, m *metrics.Metrics, opts ...Option) *Collector
New builds a Collector. Sources, stages, and sinks are registered separately so that daemon wiring can be conditional.
func (*Collector) AddSink ¶
func (c *Collector) AddSink(s runtimeevent.Sink)
AddSink registers a consumer. Every sink sees every event that survives all stages; a panicking sink does not affect the others.
func (*Collector) AddSource ¶
func (c *Collector) AddSource(src runtimeevent.Source)
AddSource registers an event producer. Nil sources are ignored.
func (*Collector) AddStage ¶
AddStage appends a stage. Stages run in registration order, and the first one to return false drops the event.
func (*Collector) Dropped ¶
Dropped returns the total number of events dropped for any reason (buffer full, or rejected/panicked stage) since New.
type Option ¶ added in v0.1.3
type Option func(*Collector)
Option configures a Collector.
func WithSourceStatusFunc ¶ added in v0.1.3
func WithSourceStatusFunc(f runtimeevent.SourceStatusFunc) Option
WithSourceStatusFunc observes the lifecycle of every registered source.