Class BatchSpanProcessor.Builder
- java.lang.Object
-
- io.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessor.Builder>
-
- io.opentelemetry.sdk.trace.export.BatchSpanProcessor.Builder
-
- Enclosing class:
- BatchSpanProcessor
public static final class BatchSpanProcessor.Builder extends io.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessor.Builder>
Builder class forBatchSpanProcessor
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchSpanProcessor
build()
Returns a newBatchSpanProcessor
that batches, then converts spans to proto and forwards them to the givenspanExporter
.protected BatchSpanProcessor.Builder
fromConfigMap(Map<String,String> configMap, io.opentelemetry.sdk.common.export.ConfigBuilder.NamingConvention namingConvention)
Sets the configuration values from the given configuration map for only the available keys.BatchSpanProcessor.Builder
setExporterTimeoutMillis(int exporterTimeoutMillis)
Sets the maximum time an exporter will be allowed to run before being cancelled.BatchSpanProcessor.Builder
setExportOnlySampled(boolean exportOnlySampled)
Set whether only sampled spans should be reported.BatchSpanProcessor.Builder
setMaxExportBatchSize(int maxExportBatchSize)
Sets the maximum batch size for every export.BatchSpanProcessor.Builder
setMaxQueueSize(int maxQueueSize)
Sets the maximum number of Spans that are kept in the queue before start dropping.BatchSpanProcessor.Builder
setScheduleDelayMillis(long scheduleDelayMillis)
Sets the delay interval between two consecutive exports.
-
-
-
Method Detail
-
fromConfigMap
protected BatchSpanProcessor.Builder fromConfigMap(Map<String,String> configMap, io.opentelemetry.sdk.common.export.ConfigBuilder.NamingConvention namingConvention)
Sets the configuration values from the given configuration map for only the available keys.- Specified by:
fromConfigMap
in classio.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessor.Builder>
- Parameters:
configMap
-Map
holding the configuration values.- Returns:
- this.
-
setExportOnlySampled
public BatchSpanProcessor.Builder setExportOnlySampled(boolean exportOnlySampled)
Set whether only sampled spans should be reported.Default value is
true
.- Parameters:
exportOnlySampled
- iftrue
report only sampled spans.- Returns:
- this.
- See Also:
DEFAULT_EXPORT_ONLY_SAMPLED
-
setScheduleDelayMillis
public BatchSpanProcessor.Builder setScheduleDelayMillis(long scheduleDelayMillis)
Sets the delay interval between two consecutive exports. The actual interval may be shorter if the batch size is getting larger thanmaxQueuedSpans / 2
.Default value is
5000
ms.- Parameters:
scheduleDelayMillis
- the delay interval between two consecutive exports.- Returns:
- this.
- See Also:
DEFAULT_SCHEDULE_DELAY_MILLIS
-
setExporterTimeoutMillis
public BatchSpanProcessor.Builder setExporterTimeoutMillis(int exporterTimeoutMillis)
Sets the maximum time an exporter will be allowed to run before being cancelled.Default value is
30000
ms- Parameters:
exporterTimeoutMillis
- the timeout for exports in milliseconds.- Returns:
- this
- See Also:
DEFAULT_EXPORT_TIMEOUT_MILLIS
-
setMaxQueueSize
public BatchSpanProcessor.Builder setMaxQueueSize(int maxQueueSize)
Sets the maximum number of Spans that are kept in the queue before start dropping.See the BatchSampledSpansProcessor class description for a high-level design description of this class.
Default value is
2048
.- Parameters:
maxQueueSize
- the maximum number of Spans that are kept in the queue before start dropping.- Returns:
- this.
- See Also:
DEFAULT_MAX_QUEUE_SIZE
-
setMaxExportBatchSize
public BatchSpanProcessor.Builder setMaxExportBatchSize(int maxExportBatchSize)
Sets the maximum batch size for every export. This must be smaller or equal tomaxQueuedSpans
.Default value is
512
.- Parameters:
maxExportBatchSize
- the maximum batch size for every export.- Returns:
- this.
- See Also:
DEFAULT_MAX_EXPORT_BATCH_SIZE
-
build
public BatchSpanProcessor build()
Returns a newBatchSpanProcessor
that batches, then converts spans to proto and forwards them to the givenspanExporter
.- Returns:
- a new
BatchSpanProcessor
. - Throws:
NullPointerException
- if thespanExporter
isnull
.
-
-