Package io.opentelemetry.sdk.logs.export
Class BatchLogRecordProcessorBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder
-
public final class BatchLogRecordProcessorBuilder extends java.lang.Object
Builder class forBatchLogRecordProcessor
.- Since:
- 1.27.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static int
DEFAULT_EXPORT_TIMEOUT_MILLIS
(package private) static int
DEFAULT_MAX_EXPORT_BATCH_SIZE
(package private) static int
DEFAULT_MAX_QUEUE_SIZE
(package private) static long
DEFAULT_SCHEDULE_DELAY_MILLIS
private long
exporterTimeoutNanos
private LogRecordExporter
logRecordExporter
private int
maxExportBatchSize
private int
maxQueueSize
private MeterProvider
meterProvider
private long
scheduleDelayNanos
-
Constructor Summary
Constructors Constructor Description BatchLogRecordProcessorBuilder(LogRecordExporter logRecordExporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchLogRecordProcessor
build()
Returns a newBatchLogRecordProcessor
that batches, then forwards them to the givenlogRecordExporter
.(package private) long
getExporterTimeoutNanos()
(package private) int
getMaxExportBatchSize()
(package private) int
getMaxQueueSize()
(package private) long
getScheduleDelayNanos()
BatchLogRecordProcessorBuilder
setExporterTimeout(long timeout, java.util.concurrent.TimeUnit unit)
Sets the maximum time an export will be allowed to run before being cancelled.BatchLogRecordProcessorBuilder
setExporterTimeout(java.time.Duration timeout)
Sets the maximum time an export will be allowed to run before being cancelled.BatchLogRecordProcessorBuilder
setMaxExportBatchSize(int maxExportBatchSize)
Sets the maximum batch size for every export.BatchLogRecordProcessorBuilder
setMaxQueueSize(int maxQueueSize)
Sets the maximum number of Logs that are kept in the queue before start dropping.BatchLogRecordProcessorBuilder
setMeterProvider(MeterProvider meterProvider)
Sets theMeterProvider
to use to collect metrics related to batch export.BatchLogRecordProcessorBuilder
setScheduleDelay(long delay, java.util.concurrent.TimeUnit unit)
Sets the delay interval between two consecutive exports.BatchLogRecordProcessorBuilder
setScheduleDelay(java.time.Duration delay)
Sets the delay interval between two consecutive exports.
-
-
-
Field Detail
-
DEFAULT_SCHEDULE_DELAY_MILLIS
static final long DEFAULT_SCHEDULE_DELAY_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_QUEUE_SIZE
static final int DEFAULT_MAX_QUEUE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_EXPORT_BATCH_SIZE
static final int DEFAULT_MAX_EXPORT_BATCH_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_EXPORT_TIMEOUT_MILLIS
static final int DEFAULT_EXPORT_TIMEOUT_MILLIS
- See Also:
- Constant Field Values
-
logRecordExporter
private final LogRecordExporter logRecordExporter
-
scheduleDelayNanos
private long scheduleDelayNanos
-
maxQueueSize
private int maxQueueSize
-
maxExportBatchSize
private int maxExportBatchSize
-
exporterTimeoutNanos
private long exporterTimeoutNanos
-
meterProvider
private MeterProvider meterProvider
-
-
Constructor Detail
-
BatchLogRecordProcessorBuilder
BatchLogRecordProcessorBuilder(LogRecordExporter logRecordExporter)
-
-
Method Detail
-
setScheduleDelay
public BatchLogRecordProcessorBuilder setScheduleDelay(long delay, java.util.concurrent.TimeUnit unit)
Sets the delay interval between two consecutive exports. If unset, defaults to 1000Lms.
-
setScheduleDelay
public BatchLogRecordProcessorBuilder setScheduleDelay(java.time.Duration delay)
Sets the delay interval between two consecutive exports. If unset, defaults to 1000Lms.
-
getScheduleDelayNanos
long getScheduleDelayNanos()
-
setExporterTimeout
public BatchLogRecordProcessorBuilder setExporterTimeout(long timeout, java.util.concurrent.TimeUnit unit)
Sets the maximum time an export will be allowed to run before being cancelled. If unset, defaults to 30000ms.
-
setExporterTimeout
public BatchLogRecordProcessorBuilder setExporterTimeout(java.time.Duration timeout)
Sets the maximum time an export will be allowed to run before being cancelled. If unset, defaults to 30000ms.
-
getExporterTimeoutNanos
long getExporterTimeoutNanos()
-
setMaxQueueSize
public BatchLogRecordProcessorBuilder setMaxQueueSize(int maxQueueSize)
Sets the maximum number of Logs that are kept in the queue before start dropping. More memory than this value may be allocated to optimize queue access.Default value is
2048
.- Parameters:
maxQueueSize
- the maximum number of Logs that are kept in the queue before start dropping.- Returns:
- this.
- See Also:
DEFAULT_MAX_QUEUE_SIZE
-
getMaxQueueSize
int getMaxQueueSize()
-
setMaxExportBatchSize
public BatchLogRecordProcessorBuilder setMaxExportBatchSize(int maxExportBatchSize)
Sets the maximum batch size for every export. This must be smaller or equal tomaxQueueSize
.Default value is
512
.- Parameters:
maxExportBatchSize
- the maximum batch size for every export.- Returns:
- this.
- See Also:
DEFAULT_MAX_EXPORT_BATCH_SIZE
-
setMeterProvider
public BatchLogRecordProcessorBuilder setMeterProvider(MeterProvider meterProvider)
Sets theMeterProvider
to use to collect metrics related to batch export. If not set, metrics will not be collected.
-
getMaxExportBatchSize
int getMaxExportBatchSize()
-
build
public BatchLogRecordProcessor build()
Returns a newBatchLogRecordProcessor
that batches, then forwards them to the givenlogRecordExporter
.- Returns:
- a new
BatchLogRecordProcessor
.
-
-