logskd

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

TODO: Fix type: s/logskd/logsdk

Index

Constants

View Source
const (
	LevelKey = attribute.Key("level")
	SpanKey  = "__SPAN__"
)

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 LogInstance
	Name() string

	// Time in UnixNano format
	Time() uint64

	Attributes() []attribute.KeyValue

	// Body of LogInstance message, we support only string
	KV() []attribute.KeyValue

	Severity() tracepb.SeverityNumber

	Span() trace.Span

	SetSpan(in trace.Span)

	TraceID() []byte
	SpanID() []byte
	TraceFlags() byte
}

type LogInstance added in v2.2.0

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

func NewLog

func NewLog(entry zapcore.Entry, kv ...attribute.KeyValue) *LogInstance

func NewLogWithTracing added in v2.3.0

func NewLogWithTracing(
	entry zapcore.Entry,
	traceID []byte,
	spanID []byte,
	traceFlags byte,
	kv ...attribute.KeyValue,
) *LogInstance

func (LogInstance) Attributes added in v2.2.0

func (l LogInstance) Attributes() []attribute.KeyValue

func (LogInstance) KV added in v2.2.0

func (l LogInstance) KV() []attribute.KeyValue

func (LogInstance) Name added in v2.2.0

func (l LogInstance) Name() string

func (*LogInstance) SetSpan added in v2.2.0

func (l *LogInstance) SetSpan(in trace.Span)

func (LogInstance) Severity added in v2.2.0

func (l LogInstance) Severity() tracepb.SeverityNumber

func (LogInstance) Span added in v2.2.0

func (l LogInstance) Span() trace.Span

func (*LogInstance) SpanID added in v2.3.0

func (l *LogInstance) SpanID() []byte

func (LogInstance) Time added in v2.2.0

func (l LogInstance) Time() uint64

func (*LogInstance) TraceFlags added in v2.3.0

func (l *LogInstance) TraceFlags() byte

func (*LogInstance) TraceID added in v2.3.0

func (l *LogInstance) TraceID() []byte

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