sdklog

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultMaxQueueSize       = 2048
	DefaultScheduleDelay      = 5000
	DefaultExportTimeout      = 30000
	DefaultMaxExportBatchSize = 512
)

Defaults for BatchSpanProcessorOptions.

Variables

This section is empty.

Functions

func NewBatchLogProcessor

func NewBatchLogProcessor(exporter LogExporter, options ...BatchLogProcessorOption) *batchLogProcessor

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

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

Types

type BatchLogProcessorOption

type BatchLogProcessorOption func(o *BatchLogProcessorOptions)

BatchLogProcessorOption configures a BatchSpanProcessor.

func WithBatchTimeout

func WithBatchTimeout(delay time.Duration) BatchLogProcessorOption

WithBatchTimeout returns a BatchSpanProcessorOption that configures the maximum delay allowed for a BatchSpanProcessor before it will export any held span (whether the queue is full or not).

func WithBlocking

func WithBlocking() BatchLogProcessorOption

WithBlocking returns a BatchSpanProcessorOption that configures a BatchSpanProcessor to wait for enqueue operations to succeed instead of dropping data when the queue is full.

func WithExportTimeout

func WithExportTimeout(timeout time.Duration) BatchLogProcessorOption

WithExportTimeout returns a BatchSpanProcessorOption that configures the amount of time a BatchSpanProcessor waits for an exporter to export before abandoning the export.

func WithMaxExportBatchSize

func WithMaxExportBatchSize(size int) BatchLogProcessorOption

WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures the maximum export batch size allowed for a BatchSpanProcessor.

func WithMaxQueueSize

func WithMaxQueueSize(size int) BatchLogProcessorOption

WithMaxQueueSize returns a BatchSpanProcessorOption that configures the maximum queue size allowed for a BatchSpanProcessor.

type BatchLogProcessorOptions

type BatchLogProcessorOptions struct {
	// MaxQueueSize is the maximum queue size to buffer spans for delayed processing. If the
	// queue gets full it drops the spans. Use BlockOnQueueFull to change this behavior.
	// The default value of MaxQueueSize is 2048.
	MaxQueueSize int

	// BatchTimeout is the maximum duration for constructing a batch. Processor
	// forcefully sends available spans when timeout is reached.
	// The default value of BatchTimeout is 5000 msec.
	BatchTimeout time.Duration

	// ExportTimeout specifies the maximum duration for exporting spans. If the timeout
	// is reached, the export will be cancelled.
	// The default value of ExportTimeout is 30000 msec.
	ExportTimeout time.Duration

	// MaxExportBatchSize is the maximum number of spans to process in a single batch.
	// If there are more than one batch worth of spans then it processes multiple batches
	// of spans one batch after the other without any delay.
	// The default value of MaxExportBatchSize is 512.
	MaxExportBatchSize int

	// BlockOnQueueFull blocks onEnd() and onStart() method if the queue is full
	// AND if BlockOnQueueFull is set to true.
	// Blocking option should be used carefully as it can severely affect the performance of an
	// application.
	BlockOnQueueFull bool
}

BatchLogProcessorOptions is configuration settings for a BatchSpanProcessor.

type LogData

type LogData struct {
	log.Record

	Resource             *resource.Resource
	InstrumentationScope instrumentation.Scope

	TraceID trace.TraceID
	SpanID  trace.SpanID
}

type LogExporter

type LogExporter interface {
	ExportLogs(ctx context.Context, logs []*LogData) error
	Shutdown(ctx context.Context) error
}

type LogProcessor

type LogProcessor interface {
	OnEmit(context.Context, *LogData)
	Shutdown(context.Context) error
}

func NewSimpleLogProcessor

func NewSimpleLogProcessor(exporter LogExporter) LogProcessor

type LoggerProvider

type LoggerProvider struct {
	embedded.LoggerProvider
	// contains filtered or unexported fields
}

func NewLoggerProvider

func NewLoggerProvider(resource *resource.Resource) *LoggerProvider

func (*LoggerProvider) Logger

func (p *LoggerProvider) Logger(name string, opts ...log.LoggerOption) log.Logger

func (*LoggerProvider) RegisterLogProcessor

func (p *LoggerProvider) RegisterLogProcessor(lp LogProcessor)

func (*LoggerProvider) Shutdown

func (p *LoggerProvider) Shutdown(ctx context.Context) error

Directories

Path Synopsis
internal/retry
Package retry provides request retry functionality that can perform configurable exponential backoff for transient errors and honor any explicit throttle responses received.
Package retry provides request retry functionality that can perform configurable exponential backoff for transient errors and honor any explicit throttle responses received.

Jump to

Keyboard shortcuts

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