Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Stateful ¶
func Stateful(s interface{}) error
Stateful is an Emitter option which makes the eventbus channel 'remember' last event sent, and when a new subscriber joins the bus, the remembered event is immediately sent to the subscription channel.
This allows to provide state tracking for dynamic systems, and/or allows new subscribers to verify that there are Emitters on the channel
Types ¶
type MetricsTracer ¶
type MetricsTracer interface {
// EventEmitted counts the total number of events grouped by event type
EventEmitted(typ reflect.Type)
// AddSubscriber adds a subscriber for the event type
AddSubscriber(typ reflect.Type)
// RemoveSubscriber removes a subscriber for the event type
RemoveSubscriber(typ reflect.Type)
// SubscriberQueueLength is the length of the subscribers channel
SubscriberQueueLength(name string, n int)
// SubscriberQueueFull tracks whether a subscribers channel if full
SubscriberQueueFull(name string, isFull bool)
// SubscriberEventQueued counts the total number of events grouped by subscriber
SubscriberEventQueued(name string)
}
MetricsTracer tracks metrics for the eventbus subsystem
func NewMetricsTracer ¶
func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer
type MetricsTracerOption ¶
type MetricsTracerOption func(*metricsTracerSetting)
func WithRegisterer ¶
func WithRegisterer(reg prometheus.Registerer) MetricsTracerOption
type Option ¶
type Option func(*basicBus)
func WithMetricsTracer ¶
func WithMetricsTracer(metricsTracer MetricsTracer) Option
Click to show internal directories.
Click to hide internal directories.