Class BatchSpanProcessorBuilder

java.lang.Object
io.opentelemetry.sdk.trace.export.BatchSpanProcessorBuilder

public final class BatchSpanProcessorBuilder extends Object
Builder class for BatchSpanProcessor.
  • Method Details

    • 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.
    • 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.
    • setMaxQueueSize

      public BatchSpanProcessorBuilder setMaxQueueSize(int maxQueueSize)
      Sets the maximum number of Spans 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 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 to maxQueueSize.

      Default value is 512.

      Parameters:
      maxExportBatchSize - the maximum batch size for every export.
      Returns:
      this.
      See Also:
      • DEFAULT_MAX_EXPORT_BATCH_SIZE
    • setMeterProvider

      public BatchSpanProcessorBuilder setMeterProvider(io.opentelemetry.api.metrics.MeterProvider meterProvider)
      Sets the MeterProvider to use to collect metrics related to batch export. If not set, metrics will not be collected.
    • build

      public BatchSpanProcessor build()
      Returns a new BatchSpanProcessor that batches, then converts spans to proto and forwards them to the given spanExporter.
      Returns:
      a new BatchSpanProcessor.