Class BatchSpanProcessorBuilder
- java.lang.Object
-
- io.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessorBuilder>
-
- io.opentelemetry.sdk.trace.export.BatchSpanProcessorBuilder
-
public final class BatchSpanProcessorBuilder extends io.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessorBuilder>
Builder class forBatchSpanProcessor.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BatchSpanProcessorbuild()Returns a newBatchSpanProcessorthat batches, then converts spans to proto and forwards them to the givenspanExporter.protected BatchSpanProcessorBuilderfromConfigMap(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.BatchSpanProcessorBuildersetExporterTimeout(long timeout, TimeUnit unit)Sets the maximum time an export will be allowed to run before being cancelled.BatchSpanProcessorBuildersetExporterTimeout(Duration timeout)Sets the maximum time an export will be allowed to run before being cancelled.BatchSpanProcessorBuildersetExporterTimeoutMillis(int exporterTimeoutMillis)Deprecated.BatchSpanProcessorBuildersetExportOnlySampled(boolean exportOnlySampled)Set whether only sampled spans should be reported.BatchSpanProcessorBuildersetMaxExportBatchSize(int maxExportBatchSize)Sets the maximum batch size for every export.BatchSpanProcessorBuildersetMaxQueueSize(int maxQueueSize)Sets the maximum number of Spans that are kept in the queue before start dropping.BatchSpanProcessorBuildersetScheduleDelay(long delay, TimeUnit unit)Sets the delay interval between two consecutive exports.BatchSpanProcessorBuildersetScheduleDelay(Duration delay)Sets the delay interval between two consecutive exports.BatchSpanProcessorBuildersetScheduleDelayMillis(long scheduleDelayMillis)Deprecated.
-
-
-
Method Detail
-
fromConfigMap
protected BatchSpanProcessorBuilder 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:
fromConfigMapin classio.opentelemetry.sdk.common.export.ConfigBuilder<BatchSpanProcessorBuilder>- Parameters:
configMap-Mapholding the configuration values.- Returns:
- this.
-
setExportOnlySampled
public BatchSpanProcessorBuilder setExportOnlySampled(boolean exportOnlySampled)
Set whether only sampled spans should be reported.Default value is
true.- Parameters:
exportOnlySampled- iftruereport only sampled spans.- Returns:
- this.
- See Also:
DEFAULT_EXPORT_ONLY_SAMPLED
-
setScheduleDelay
public BatchSpanProcessorBuilder setScheduleDelay(long delay, TimeUnit unit)
Sets the delay interval between two consecutive exports. If unset, defaults to 5000Lms.
-
setScheduleDelay
public BatchSpanProcessorBuilder setScheduleDelay(Duration delay)
Sets the delay interval between two consecutive exports. If unset, defaults to 5000Lms.
-
setScheduleDelayMillis
@Deprecated public BatchSpanProcessorBuilder setScheduleDelayMillis(long scheduleDelayMillis)
Deprecated.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
5000ms.- Parameters:
scheduleDelayMillis- the delay interval between two consecutive exports.- Returns:
- this.
- See Also:
DEFAULT_SCHEDULE_DELAY_MILLIS
-
setExporterTimeout
public BatchSpanProcessorBuilder setExporterTimeout(long timeout, TimeUnit unit)
Sets the maximum time an export will be allowed to run before being cancelled. If unset, defaults to 30000ms.
-
setExporterTimeout
public BatchSpanProcessorBuilder setExporterTimeout(Duration timeout)
Sets the maximum time an export will be allowed to run before being cancelled. If unset, defaults to 30000ms.
-
setExporterTimeoutMillis
@Deprecated public BatchSpanProcessorBuilder setExporterTimeoutMillis(int exporterTimeoutMillis)
Deprecated.Sets the maximum time an exporter will be allowed to run before being cancelled.Default value is
30000ms- Parameters:
exporterTimeoutMillis- the timeout for exports in milliseconds.- Returns:
- this
- See Also:
DEFAULT_EXPORT_TIMEOUT_MILLIS
-
setMaxQueueSize
public BatchSpanProcessorBuilder 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 BatchSpanProcessorBuilder 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 newBatchSpanProcessorthat batches, then converts spans to proto and forwards them to the givenspanExporter.- Returns:
- a new
BatchSpanProcessor. - Throws:
NullPointerException- if thespanExporterisnull.
-
-