Documentation ¶
Index ¶
- Constants
- func NewBatchCore(syncer *BatchWriteSyncer, opts ...sdklog.LoggerOption) zapcore.Core
- func NewBatchCoreAndLevel(syncer *BatchWriteSyncer, opts ...sdklog.LoggerOption) (zapcore.Core, zap.AtomicLevel)
- func NewCore(opts ...sdklog.LoggerOption) zapcore.Core
- func NewEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func NewJSONCore() zapcore.Core
- func NewJSONWriteSyncer() zapcore.WriteSyncer
- func NewWriteSyncer(p *sdklog.BatchProcessor, rs *resource.Resource) zapcore.WriteSyncer
- type BatchSyncerOption
- func WithBatchTimeout(delay time.Duration) BatchSyncerOption
- func WithBlocking() BatchSyncerOption
- func WithEnableSampler(enableSampler bool) BatchSyncerOption
- func WithEnableSamplerError(enableSamplerError bool) BatchSyncerOption
- func WithMaxExportBatchSize(size int) BatchSyncerOption
- func WithMaxPacketSize(size int) BatchSyncerOption
- func WithMaxQueueSize(size int) BatchSyncerOption
- type BatchSyncerOptions
- type BatchWriteSyncer
Constants ¶
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 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