flusher

package
v2.0.0-...-675b67f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

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"`

	// MaxRetryTime maximum duration to continue retrying for
	// Defaults to 1 Hour
	MaxRetryTime time.Duration `json:"max_retry_time" yaml:"max_retry_time"`

	// MaxRetryInterval the maximum retry interval duration.
	// Defaults to 1 Minute
	MaxRetryInterval time.Duration `json:"max_retry_interval" yaml:"max_retry_interval"`
}

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(logger *zap.SugaredLogger) *Flusher

Build uses a Config to build a new Flusher

type FlushFunc

type FlushFunc func(context.Context) error

FlushFunc is any function that flushes

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 concurrency, retry behavior, and cancellation.

func (*Flusher) Do

func (f *Flusher) Do(ctx context.Context, flush FlushFunc)

Do executes the flusher function in a goroutine

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