flusher

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxConcurrent is the maximum number of goroutines flushing entries concurrently.
	// Defaults to 16.
	MaxConcurrent int `json:"max_concurrent" yaml:"max_concurrent"`

	// MaxWait is the maximum amount of time to wait for a full slice of entries
	// before flushing the entries. Defaults to 1s.
	MaxWait helper.Duration `json:"max_wait" yaml:"max_wait"`

	// MaxChunkEntries is the maximum number of entries to flush at a time.
	// Defaults to 1000.
	MaxChunkEntries int `json:"max_chunk_entries" yaml:"max_chunk_entries"`
}

Config holds the configuration to build a new flusher

func NewConfig

func NewConfig() Config

NewConfig creates a new default flusher config

func (*Config) Build

func (c *Config) Build(buf buffer.Buffer, f FlushFunc, logger *zap.SugaredLogger) *Flusher

Build uses a Config to build a new Flusher

type FlushFunc

type FlushFunc func(context.Context, []*entry.Entry) error

FlushFunc is a function that the flusher uses to flush a slice of entries

type Flusher

type Flusher struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

Flusher is used to flush entries from a buffer concurrently. It handles max concurrenty, retry behavior, and cancellation.

func (*Flusher) Start

func (f *Flusher) Start()

Start begins flushing

func (*Flusher) Stop

func (f *Flusher) Stop()

Stop cancels all the in-progress flushers and waits until they have returned

Jump to

Keyboard shortcuts

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