BatchSpanProcessor
in package
implements
SpanProcessorInterface
uses
LogsMessagesTrait
Table of Contents
Interfaces
Constants
- DEFAULT_EXPORT_TIMEOUT = 30000
- DEFAULT_MAX_EXPORT_BATCH_SIZE = 512
- DEFAULT_MAX_QUEUE_SIZE = 2048
- DEFAULT_SCHEDULE_DELAY = 5000
- ATTRIBUTES_DROPPED = self::ATTRIBUTES_PROCESSOR + ['state' => 'dropped']
- ATTRIBUTES_FREE = self::ATTRIBUTES_PROCESSOR + ['state' => 'free']
- ATTRIBUTES_PENDING = self::ATTRIBUTES_PROCESSOR + ['state' => 'pending']
- ATTRIBUTES_PROCESSED = self::ATTRIBUTES_PROCESSOR + ['state' => 'processed']
- ATTRIBUTES_PROCESSOR = ['processor' => 'batching']
- ATTRIBUTES_QUEUED = self::ATTRIBUTES_PROCESSOR + ['state' => 'queued']
Properties
- $autoFlush : bool
- $batch : array<int, SpanDataInterface>
- $batchId : int
- $clock : ClockInterface
- $closed : bool
- $dropped : int
- $exportContext : ContextInterface
- $exporter : SpanExporterInterface
- $flush : SplQueue<string|int, ContextInterface}>
- $maxExportBatchSize : int
- $maxQueueSize : int
- $nextScheduledRun : int|null
- $processed : int
- $queue : SplQueue<string|int, array<int, SpanDataInterface>>
- $queueSize : int
- $running : bool
- $scheduledDelayNanos : int
Methods
- __construct() : mixed
- builder() : BatchSpanProcessorBuilder
- forceFlush() : bool
- Export all ended spans to the configured Exporter that have not yet been exported.
- onEnd() : void
- onStart() : void
- shutdown() : bool
- Cleanup; after shutdown, calling onStart, onEnd, or forceFlush is invalid Returns `false` is the processor is already shutdown, otherwise `true`.
- logDebug() : void
- logError() : void
- logInfo() : void
- logNotice() : void
- logWarning() : void
- doLog() : void
- enqueueBatch() : void
- flush() : bool
- shouldFlush() : bool
- shouldLog() : bool
Constants
DEFAULT_EXPORT_TIMEOUT
public
mixed
DEFAULT_EXPORT_TIMEOUT
= 30000
DEFAULT_MAX_EXPORT_BATCH_SIZE
public
mixed
DEFAULT_MAX_EXPORT_BATCH_SIZE
= 512
DEFAULT_MAX_QUEUE_SIZE
public
mixed
DEFAULT_MAX_QUEUE_SIZE
= 2048
DEFAULT_SCHEDULE_DELAY
public
mixed
DEFAULT_SCHEDULE_DELAY
= 5000
ATTRIBUTES_DROPPED
private
mixed
ATTRIBUTES_DROPPED
= self::ATTRIBUTES_PROCESSOR + ['state' => 'dropped']
ATTRIBUTES_FREE
private
mixed
ATTRIBUTES_FREE
= self::ATTRIBUTES_PROCESSOR + ['state' => 'free']
ATTRIBUTES_PENDING
private
mixed
ATTRIBUTES_PENDING
= self::ATTRIBUTES_PROCESSOR + ['state' => 'pending']
ATTRIBUTES_PROCESSED
private
mixed
ATTRIBUTES_PROCESSED
= self::ATTRIBUTES_PROCESSOR + ['state' => 'processed']
ATTRIBUTES_PROCESSOR
private
mixed
ATTRIBUTES_PROCESSOR
= ['processor' => 'batching']
ATTRIBUTES_QUEUED
private
mixed
ATTRIBUTES_QUEUED
= self::ATTRIBUTES_PROCESSOR + ['state' => 'queued']
Properties
$autoFlush read-only
private
bool
$autoFlush
= true
$batch
private
array<int, SpanDataInterface>
$batch
= []
$batchId
private
int
$batchId
= 0
$clock read-only
private
ClockInterface
$clock
$closed
private
bool
$closed
= false
$dropped
private
int
$dropped
= 0
$exportContext
private
ContextInterface
$exportContext
$exporter read-only
private
SpanExporterInterface
$exporter
$flush
private
SplQueue<string|int, ContextInterface}>
$flush
$maxExportBatchSize
private
int
$maxExportBatchSize
$maxQueueSize
private
int
$maxQueueSize
$nextScheduledRun
private
int|null
$nextScheduledRun
= null
$processed
private
int
$processed
= 0
$queue
private
SplQueue<string|int, array<int, SpanDataInterface>>
$queue
$queueSize
private
int
$queueSize
= 0
$running
private
bool
$running
= false
$scheduledDelayNanos
private
int
$scheduledDelayNanos
Methods
__construct()
public
__construct(SpanExporterInterface $exporter, ClockInterface $clock[, int $maxQueueSize = self::DEFAULT_MAX_QUEUE_SIZE ][, int $scheduledDelayMillis = self::DEFAULT_SCHEDULE_DELAY ][, int $exportTimeoutMillis = self::DEFAULT_EXPORT_TIMEOUT ][, int $maxExportBatchSize = self::DEFAULT_MAX_EXPORT_BATCH_SIZE ][, bool $autoFlush = true ][, MeterProviderInterface|null $meterProvider = null ]) : mixed
Parameters
- $exporter : SpanExporterInterface
- $clock : ClockInterface
- $maxQueueSize : int = self::DEFAULT_MAX_QUEUE_SIZE
- $scheduledDelayMillis : int = self::DEFAULT_SCHEDULE_DELAY
- $exportTimeoutMillis : int = self::DEFAULT_EXPORT_TIMEOUT
- $maxExportBatchSize : int = self::DEFAULT_MAX_EXPORT_BATCH_SIZE
- $autoFlush : bool = true
- $meterProvider : MeterProviderInterface|null = null
builder()
public
static builder(SpanExporterInterface $exporter) : BatchSpanProcessorBuilder
Parameters
- $exporter : SpanExporterInterface
Return values
BatchSpanProcessorBuilderforceFlush()
Export all ended spans to the configured Exporter that have not yet been exported.
public
forceFlush([CancellationInterface|null $cancellation = null ]) : bool
Returns true
if the flush was successful, otherwise false
.
Parameters
- $cancellation : CancellationInterface|null = null
Return values
boolonEnd()
public
onEnd(ReadableSpanInterface $span) : void
Parameters
- $span : ReadableSpanInterface
onStart()
public
onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext) : void
Parameters
- $span : ReadWriteSpanInterface
- $parentContext : ContextInterface
shutdown()
Cleanup; after shutdown, calling onStart, onEnd, or forceFlush is invalid Returns `false` is the processor is already shutdown, otherwise `true`.
public
shutdown([CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $cancellation : CancellationInterface|null = null
Return values
boollogDebug()
protected
static logDebug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logError()
protected
static logError(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logInfo()
protected
static logInfo(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logNotice()
protected
static logNotice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
logWarning()
protected
static logWarning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
doLog()
private
static doLog(string $level, string $message, array<string|int, mixed> $context) : void
Parameters
- $level : string
- $message : string
- $context : array<string|int, mixed>
enqueueBatch()
private
enqueueBatch() : void
flush()
private
flush([string|null $flushMethod = null ][, CancellationInterface|null $cancellation = null ]) : bool
Parameters
- $flushMethod : string|null = null
- $cancellation : CancellationInterface|null = null
Return values
boolshouldFlush()
private
shouldFlush() : bool
Return values
boolshouldLog()
private
static shouldLog(string $level) : bool
Parameters
- $level : string