logbridge

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This package implements a log bridge. It is a bridge in the literal sense - it will carry logs from one side to the other until it reaches its capacity. When the bridge is at its capacity, it will drop new entries instead of blocking. This behaviour is desirable because it makes this package safe to attach to the logging end of an executable

A typical use for this package is to attach it to stdout of an executable and passing the results into your system's proprietary logging backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRetriableError

func NewRetriableError(err error) retriableError

Types

type LogBridge

type LogBridge struct {
	Reader        io.Reader
	DurableWriter io.Writer
	LossyWriter   io.Writer
	// contains filtered or unexported fields
}

func NewLogBridge

func NewLogBridge(r io.Reader,
	durableWriter io.Writer,
	lossyWriter io.Writer,
	logger logging.Logger,
	writePerSec int,
	bytesPerSec int,
	metricsRegistry MetricsRegistry,
	loglineMetricKeyName string,
	logByteMetricKeyName string,
	droppedLineMetricKeyName string,
	throttledMsKeyName string) *LogBridge

func (*LogBridge) LossyCopy

func (lb *LogBridge) LossyCopy(r io.Reader, capacity int)

LossyCopy implements a buffered copy operation between dest and src. It returns the number of dropped messages as a result of insufficient capacity

func (*LogBridge) Tee

func (lb *LogBridge) Tee()

Tee will copy to durableWriter without dropping messages. Lines written to lossyWriter will be copied best effort with respect to latency on the writer. Writes to lossyWriter are buffered through a go channel.

type MetricsRegistry

type MetricsRegistry interface {
	Register(metricName string, metric interface{}) error
}

Jump to

Keyboard shortcuts

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