otelzap

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultMaxQueueSize         = 2048
	DefaultBatchTimeout         = 5000 * time.Millisecond
	DefaultMaxExportBatchSize   = 512
	DefaultBlockOnQueueFull     = false
	DefaultMaxBatchedPacketSize = 2097152 // need to be reported when accumulated log size reach 2MB
)

Variables

This section is empty.

Functions

func NewBatchCore

func NewBatchCore(syncer *BatchWriteSyncer, opts ...sdklog.LoggerOption) zapcore.Core

NewBatchCore batch create zap core instances

func NewBatchCoreAndLevel

func NewBatchCoreAndLevel(syncer *BatchWriteSyncer, opts ...sdklog.LoggerOption) (zapcore.Core, zap.AtomicLevel)

NewBatchCoreAndLevel NewBatchCore with log level returned

func NewCore

func NewCore(opts ...sdklog.LoggerOption) zapcore.Core

NewCore create zap core instance

func NewEncoder

func NewEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder

NewEncoder return zapcore.Encoder

func NewJSONCore

func NewJSONCore() zapcore.Core

NewJSONCore get zap core with JSON encoder

func NewJSONWriteSyncer

func NewJSONWriteSyncer() zapcore.WriteSyncer

NewJSONWriteSyncer get jsonWriteSyncer instance

func NewWriteSyncer

func NewWriteSyncer(p *sdklog.BatchProcessor, rs *resource.Resource) zapcore.WriteSyncer

NewWriteSyncer create writeSyncer instance

Types

type BatchSyncerOption

type BatchSyncerOption func(o *BatchSyncerOptions)

BatchSyncerOption apply changes to internalOptions.

func WithBatchTimeout

func WithBatchTimeout(delay time.Duration) BatchSyncerOption

WithBatchTimeout return BatchSyncerOption which to set BatchTimeout

func WithBlocking

func WithBlocking() BatchSyncerOption

WithBlocking return BatchSyncerOption which to set BlockOnQueueFull

func WithEnableSampler

func WithEnableSampler(enableSampler bool) BatchSyncerOption

WithEnableSampler set sampler option

func WithEnableSamplerError

func WithEnableSamplerError(enableSamplerError bool) BatchSyncerOption

WithEnableSamplerError set error sampler option

func WithMaxExportBatchSize

func WithMaxExportBatchSize(size int) BatchSyncerOption

WithMaxExportBatchSize return BatchSyncerOption which to set MaxExportBatchSize

func WithMaxPacketSize

func WithMaxPacketSize(size int) BatchSyncerOption

WithMaxPacketSize WithMaxPacketSize

func WithMaxQueueSize

func WithMaxQueueSize(size int) BatchSyncerOption

WithMaxQueueSize return BatchSyncerOption which to set MaxQueueSize

type BatchSyncerOptions

type BatchSyncerOptions 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

	// 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

	// EnableSampler
	EnableSampler bool

	// EnableSamplerError
	EnableSamplerError bool

	// MaxPacketSize is the maximum number of packet size that will forcefully trigger a batch process.
	// The default value of MaxPacketSize is 2M (in bytes) .
	MaxPacketSize int
}

BatchSyncerOptions defines the configuration for the various elements of BatchSyncer

type BatchWriteSyncer

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

BatchWriteSyncer implement zapcore.WriteSyncer

func NewBatchWriteSyncer

func NewBatchWriteSyncer(exporter sdklog.Exporter, rs *resource.Resource, opts ...BatchSyncerOption) *BatchWriteSyncer

NewBatchWriteSyncer return BatchWriteSyncer

func (*BatchWriteSyncer) Enqueue

func (bp *BatchWriteSyncer) Enqueue(sl *logsproto.ScopeLogs, size int)

Enqueue enqueue ResourceLogs to bp.queue

func (*BatchWriteSyncer) Sync

func (bp *BatchWriteSyncer) Sync() error

Sync implement Sync interface

func (*BatchWriteSyncer) Write

func (bp *BatchWriteSyncer) Write(p []byte) (n int, err error)

Write implement Write interface

Jump to

Keyboard shortcuts

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