Documentation ¶
Index ¶
Constants ¶
const ( DefaultMaxQueueSize = 2048 DefaultBatchTimeout = 5000 * time.Millisecond DefaultMaxExportBatchSize = 512 DefaultMaxBatchedPacketSize = 2097152 DefaultBlockOnQueueFull = false )
Variables ¶
This section is empty.
Functions ¶
func Resource ¶
func Resource(r *resource.Resource) *resourceproto.Resource
Resource transforms a Resource into an OTLP Resource.
func ResourceAttributes ¶
func ResourceAttributes(resource *resource.Resource) []*commonproto.KeyValue
ResourceAttributes transforms a Resource into a slice of OTLP attribute key-values.
Types ¶
type BatchProcessor ¶
type BatchProcessor struct {
// contains filtered or unexported fields
}
BatchProcessor is a component that accepts spans and metrics, places them into batches and sends downstream.
func NewBatchProcessor ¶
func NewBatchProcessor(exporter Exporter) *BatchProcessor
NewBatchProcessor return BatchProcessor
func (*BatchProcessor) Enqueue ¶
func (bp *BatchProcessor) Enqueue(rl *logsproto.ResourceLogs)
Enqueue enqueue ResourceLogs to batch queue
type BatchProcessorOption ¶
type BatchProcessorOption func(o *BatchProcessorOptions)
BatchProcessorOption apply changes to internalOptions.
func WithBatchTimeout ¶
func WithBatchTimeout(delay time.Duration) BatchProcessorOption
WithBatchTimeout return BatchProcessorOption which to set BatchTimeout
func WithBlocking ¶
func WithBlocking() BatchProcessorOption
WithBlocking return BatchProcessorOption which to set BlockOnQueueFull
func WithMaxExportBatchSize ¶
func WithMaxExportBatchSize(size int) BatchProcessorOption
WithMaxExportBatchSize return BatchProcessorOption which to set MaxExportBatchSize
func WithMaxQueueSize ¶
func WithMaxQueueSize(size int) BatchProcessorOption
WithMaxQueueSize return BatchProcessorOption which to set MaxQueueSize
type BatchProcessorOptions ¶
type BatchProcessorOptions 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 }
BatchProcessorOptions defines the configuration for the various elements of BatchProcessor
type Exporter ¶
type Exporter interface { ExportLogs(context.Context, []*logsproto.ResourceLogs) error Shutdown(ctx context.Context) error }
Exporter exports telemetry log data from the collector to a destination.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logger impl
type LoggerOption ¶
type LoggerOption func(*LoggerOptions)
LoggerOption logger option func
func WithBatcher ¶
func WithBatcher(batcher *BatchProcessor) LoggerOption
WithBatcher setting Processor
func WithEnableSampler ¶
func WithEnableSampler(enableSampler bool) LoggerOption
WithEnableSampler enable sample along with trace.
func WithEnableSamplerError ¶
func WithEnableSamplerError(enableSampler bool) LoggerOption
WithEnableSamplerError when EnableSampler is true,report error log when not sampled
func WithLevelEnable ¶
func WithLevelEnable(level log.Level) LoggerOption
WithLevelEnable enable level
func WithResource ¶
func WithResource(rs *resource.Resource) LoggerOption
WithResource setting resource info
type LoggerOptions ¶
type LoggerOptions struct { // Resource contains attributes representing an entity that produces telemetry. Resource *resource.Resource // Processor export logs Processor *BatchProcessor // LevelEnabled enabled level LevelEnabled log.Level // LevelNumber enabled level number according to LevelEnabled LevelNumber logsproto.SeverityNumber // EnableSampler enable sampler. EnableSampler bool // EnableSamplerError when EnableSampler is true,report error log when not sampled EnableSamplerError bool }
LoggerOptions logger options detail