Versions in this module Expand all Collapse all v0 v0.1.1 Dec 2, 2020 Changes in this version + var EventCount = stats.Int64("evbundler/event_count", "Number of processed events", stats.UnitDimensionless) + var KeyEventErr = tag.NewKey("event_err") + var KeyWorkerState = tag.NewKey("worker.state") + var WorkerCount = stats.Int64("evbundler/worker_count", "Number of total workers", stats.UnitDimensionless) + func NewMetrics() *metrics + func NewWorkerPool(n int, f WorkerFunc) *workerPool + func TickerProducer(ctx context.Context, d time.Duration, f func(time.Time, chan Event)) chan Event + type Dispatcher interface + Dispatch func(context.Context, chan Event) error + type Event interface + Fire func(ctx context.Context) error + Name func() string + type EventBundler struct + func (ep *EventBundler) In(ev chan Event) + func (ep *EventBundler) Out() <-chan Event + func (ep *EventBundler) Start(ctx context.Context) + type LatencyMetrics struct + Max time.Duration + Mean time.Duration + P50 time.Duration + P90 time.Duration + P95 time.Duration + P99 time.Duration + Total time.Duration + func (l *LatencyMetrics) Add(latency time.Duration) + func (l *LatencyMetrics) MarshalJSON() ([]byte, error) + func (l LatencyMetrics) Quantile(nth float64) time.Duration + type Metrics interface + Add func(*Result) + MarshalJSON func() ([]byte, error) + type Producer interface + Produce func(ctx context.Context) chan Event + type Result struct + Error error + EventName string + Latency time.Duration + Timestamp time.Time + Weight int + func (r *Result) End() time.Time + type Results []Result + func (rs *Results) Add(r *Result) + func (rs Results) Len() int + func (rs Results) Less(i, j int) bool + func (rs Results) Swap(i, j int) + type Worker interface + Close func() error + Process func(context.Context, Event) *Result + type WorkerFunc func(context.Context, Event) error + type WorkerPool interface + Get func() Worker + Len func() int + Put func(Worker) + type WorkerState int + const StateActive + const StateDead + const StateProcess + const StateWaiting + func (ws WorkerState) String() string