logger_batch

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBatchMaxSize    = 1000
	DefaultMaxRetryCount   = 0
	DefaultRetryDelay      = time.Second
	DefaultBufferDuration  = time.Minute
	DefaultInactiveTimeout = 5 * time.Second

	DefaultMaxPendingEntries       = 10000
	DefaultMaxConcurrentDeliveries = 1
	DefaultDeliveryTimeout         = 10 * time.Second
	DefaultShutdownTimeout         = 15 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name              string
	PluginID          string
	BatchMaxSize      int
	MaxRetryCount     int
	RetryDelay        time.Duration
	RetryDelaySet     bool
	BufferDuration    time.Duration
	InactiveTimeout   time.Duration
	MaxPendingEntries int

	MaxConcurrentDeliveries int
	DeliveryTimeout         time.Duration
	ShutdownTimeout         time.Duration

	RouteID    string
	ServerAddr string
}

type ContextDeliveryFunc

type ContextDeliveryFunc func(ctx context.Context, entries []map[string]any, batchMaxSize int) (firstFail int, err error)

ContextDeliveryFunc must stop transport work and return after ctx is done. Sink resources remain owned until the callback has actually returned.

type DeliveryFunc

type DeliveryFunc func(entries []map[string]any, batchMaxSize int) (firstFail int, err error)

type Processor

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

func New

func New(config Config, deliver DeliveryFunc) *Processor

func NewWithContext

func NewWithContext(config Config, deliver ContextDeliveryFunc) *Processor

func (*Processor) Flush

func (p *Processor) Flush()

func (*Processor) Push

func (p *Processor) Push(entry map[string]any) bool

func (*Processor) Shutdown

func (p *Processor) Shutdown(ctx context.Context) error

func (*Processor) Stats

func (p *Processor) Stats() Stats

func (*Processor) Stop

func (p *Processor) Stop()

func (*Processor) StopWithCleanup

func (p *Processor) StopWithCleanup(cleanup func())

StopWithCleanup keeps delivery-owned resources alive until every callback has returned. Stop remains bounded; if a callback ignores cancellation, the cleanup runs asynchronously after that callback eventually exits.

type Stats

type Stats struct {
	Pending     int
	Processing  int
	Buffered    int
	Dropped     int
	Delivered   int
	FailedDrops int
}

Jump to

Keyboard shortcuts

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