logskd

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvLvl

func ConvLvl(in zapcore.Level) tracepb.SeverityNumber

Types

type Exporter

type Exporter interface {

	// ExportLogs exports a batch of logs.
	//
	// This function is called synchronously, so there is no concurrency
	// safety requirement. However, due to the synchronous calling pattern,
	// it is critical that all timeouts and cancellations contained in the
	// passed context must be honored.
	//
	// Any retry logic must be contained in this function. The SDK that
	// calls this function will not implement any retry logic. All errors
	// returned by this function are considered unrecoverable and will be
	// reported to a configured error Handler.
	ExportLogs(ctx context.Context, spans []Log) error

	// Shutdown notifies the exporter of a pending halt to operations. The
	// exporter is expected to preform any cleanup or synchronization it
	// requires while honoring all timeouts and cancellations contained in
	// the passed context.
	Shutdown(ctx context.Context) error
}

Exporter handles the delivery of spans to external receivers. This is the final component in the trace export pipeline.

type Log

type Log interface {
	// Name of the log
	Name() string

	// Time in UnixNano format
	Time() uint64

	// Attributes returns the defining attributes of the log.
	// here we expect: level description of
	Attributes() []attribute.KeyValue

	// Body of log message, we support only string
	Body() string

	Severity() tracepb.SeverityNumber

	Span() trace.Span

	SetSpan(in trace.Span)
}

func NewLog

func NewLog(entry zapcore.Entry, body []byte, attributes ...attribute.KeyValue) Log

type LogProcessor

type LogProcessor interface {
	// Write log to processor
	Write(s Log)

	// Shutdown is called when the SDK shuts down. Any cleanup or release of
	// resources held by the processor should be done in this call.
	//
	// Calls to OnStart, OnEnd, or ForceFlush after this has been called
	// should be ignored.
	//
	// All timeouts and cancellations contained in ctx must be honored, this
	// should not block indefinitely.
	Shutdown(ctx context.Context) error

	// ForceFlush exports all ended spans to the configured Exporter that have not yet
	// been exported.  It should only be called when absolutely necessary, such as when
	// using a FaaS provider that may suspend the process after an invocation, but before
	// the Processor can export the completed spans.
	ForceFlush(ctx context.Context) error
}

func NewBatchLogProcessor

func NewBatchLogProcessor(exporter Exporter, options ...trace.BatchSpanProcessorOption) LogProcessor

NewBatchLogProcessor creates a new LogProcessor that will send completed span batches to the exporter with the supplied options.

If the exporter is nil, the span processor will preform no action.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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