batcher

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batcher

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

Batcher collects spans to send them to exporters in batches

func New

func New(exporter klogga.Exporter, conf Config) *Batcher

New constructs and starts the Batcher beware that errors from the exporter are ignored, so if you really need them use a decorator or something

func (*Batcher) ErredCount

func (b *Batcher) ErredCount() (res uint64)

func (*Batcher) FlushedCount

func (b *Batcher) FlushedCount() (res uint64)

func (*Batcher) Shutdown

func (b *Batcher) Shutdown(ctx context.Context) (err error)

func (*Batcher) TriggerFlush

func (b *Batcher) TriggerFlush()

TriggerFlush asynchronously writes queue content to writer

func (*Batcher) Write

func (b *Batcher) Write(ctx context.Context, spans []*klogga.Span) error

type Config

type Config struct {
	BatchSize  int
	BufferSize int // how many spans to be buffered before blocking, BatchSize*5 if zero
	Timeout    time.Duration
}

func ConfigDefault

func ConfigDefault() Config

func (*Config) GetBatchSize

func (c *Config) GetBatchSize() int

func (*Config) GetBufferSize

func (c *Config) GetBufferSize() int

type DelayDrop

type DelayDrop struct {
	Delay time.Duration
	Count atomic.Int32
}

func (*DelayDrop) Shutdown

func (n *DelayDrop) Shutdown(context.Context) error

func (*DelayDrop) Write

func (n *DelayDrop) Write(ctx context.Context, spans []*klogga.Span) error

Jump to

Keyboard shortcuts

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