public BatchLogRecordExportProcessor(
     BaseExporter <LogRecord> exporter,
     int maxQueueSize = DefaultMaxQueueSize,
     int scheduledDelayMilliseconds  = DefaultScheduledDelayMilliseconds,
     int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds,
     int maxExportBatchSize          = DefaultMaxExportBatchSize)
     : base(
         exporter,
         maxQueueSize,
         scheduledDelayMilliseconds,
         exporterTimeoutMilliseconds,
         maxExportBatchSize)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchExportProcessor{T}"/> class.
        /// </summary>
        /// <param name="exporter">Exporter instance.</param>
        /// <param name="maxQueueSize">The maximum queue size. After the size is reached data are dropped. The default value is 2048.</param>
        /// <param name="scheduledDelayMilliseconds">The delay interval in milliseconds between two consecutive exports. The default value is 5000.</param>
        /// <param name="exporterTimeoutMilliseconds">How long the export can run before it is cancelled. The default value is 30000.</param>
        /// <param name="maxExportBatchSize">The maximum batch size of every export. It must be smaller or equal to maxQueueSize. The default value is 512.</param>
        protected BatchExportProcessor(
            BaseExporter <T> exporter,
            int maxQueueSize = DefaultMaxQueueSize,
            int scheduledDelayMilliseconds  = DefaultScheduledDelayMilliseconds,
            int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds,
            int maxExportBatchSize          = DefaultMaxExportBatchSize)
            : base(exporter)
        {
            if (maxQueueSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxQueueSize), maxQueueSize, "maxQueueSize should be greater than zero.");
            }

            if (maxExportBatchSize <= 0 || maxExportBatchSize > maxQueueSize)
            {
                throw new ArgumentOutOfRangeException(nameof(maxExportBatchSize), maxExportBatchSize, "maxExportBatchSize should be greater than zero and less than maxQueueSize.");
            }

            if (scheduledDelayMilliseconds <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(scheduledDelayMilliseconds), scheduledDelayMilliseconds, "scheduledDelayMilliseconds should be greater than zero.");
            }

            if (exporterTimeoutMilliseconds < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(exporterTimeoutMilliseconds), exporterTimeoutMilliseconds, "exporterTimeoutMilliseconds should be non-negative.");
            }

            this.circularBuffer              = new CircularBuffer <T>(maxQueueSize);
            this.scheduledDelayMilliseconds  = scheduledDelayMilliseconds;
            this.exporterTimeoutMilliseconds = exporterTimeoutMilliseconds;
            this.maxExportBatchSize          = maxExportBatchSize;
            this.exporterThread              = new Thread(new ThreadStart(this.ExporterProc))
            {
                IsBackground = true,
                Name         = $"OpenTelemetry-{nameof(BatchExportProcessor<T>)}-{exporter.GetType().Name}",
            };
            this.exporterThread.Start();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchExportProcessor{T}"/> class.
        /// </summary>
        /// <param name="exporter">Exporter instance.</param>
        /// <param name="maxQueueSize">The maximum queue size. After the size is reached data are dropped. The default value is 2048.</param>
        /// <param name="scheduledDelayMilliseconds">The delay interval in milliseconds between two consecutive exports. The default value is 5000.</param>
        /// <param name="exporterTimeoutMilliseconds">How long the export can run before it is cancelled. The default value is 30000.</param>
        /// <param name="maxExportBatchSize">The maximum batch size of every export. It must be smaller or equal to maxQueueSize. The default value is 512.</param>
        public BatchExportProcessor(
            BaseExporter <T> exporter,
            int maxQueueSize = 2048,
            int scheduledDelayMilliseconds  = 5000,
            int exporterTimeoutMilliseconds = 30000,
            int maxExportBatchSize          = 512)
            : base(exporter)
        {
            if (maxQueueSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxQueueSize));
            }

            if (maxExportBatchSize <= 0 || maxExportBatchSize > maxQueueSize)
            {
                throw new ArgumentOutOfRangeException(nameof(maxExportBatchSize));
            }

            if (scheduledDelayMilliseconds <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(scheduledDelayMilliseconds));
            }

            if (exporterTimeoutMilliseconds < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(exporterTimeoutMilliseconds));
            }

            this.circularBuffer              = new CircularBuffer <T>(maxQueueSize);
            this.scheduledDelayMilliseconds  = scheduledDelayMilliseconds;
            this.exporterTimeoutMilliseconds = exporterTimeoutMilliseconds;
            this.maxExportBatchSize          = maxExportBatchSize;
            this.exporterThread              = new Thread(new ThreadStart(this.ExporterProc))
            {
                IsBackground = true,
                Name         = $"OpenTelemetry-{nameof(BatchExportProcessor<T>)}-{exporter.GetType().Name}",
            };
            this.exporterThread.Start();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchExportProcessor{T}"/> class.
        /// </summary>
        /// <param name="exporter">Exporter instance.</param>
        /// <param name="maxQueueSize">The maximum queue size. After the size is reached data are dropped. The default value is 2048.</param>
        /// <param name="scheduledDelayMilliseconds">The delay interval in milliseconds between two consecutive exports. The default value is 5000.</param>
        /// <param name="exporterTimeoutMilliseconds">How long the export can run before it is cancelled. The default value is 30000.</param>
        /// <param name="maxExportBatchSize">The maximum batch size of every export. It must be smaller or equal to maxQueueSize. The default value is 512.</param>
        protected BatchExportProcessor(
            BaseExporter <T> exporter,
            int maxQueueSize = DefaultMaxQueueSize,
            int scheduledDelayMilliseconds  = DefaultScheduledDelayMilliseconds,
            int exporterTimeoutMilliseconds = DefaultExporterTimeoutMilliseconds,
            int maxExportBatchSize          = DefaultMaxExportBatchSize)
            : base(exporter)
        {
            Guard.Range(maxQueueSize, nameof(maxQueueSize), min: 1);
            Guard.Range(maxExportBatchSize, nameof(maxExportBatchSize), min: 1, max: maxQueueSize, maxName: nameof(maxQueueSize));
            Guard.Range(scheduledDelayMilliseconds, nameof(scheduledDelayMilliseconds), min: 1);
            Guard.Range(exporterTimeoutMilliseconds, nameof(exporterTimeoutMilliseconds), min: 0);

            this.circularBuffer              = new CircularBuffer <T>(maxQueueSize);
            this.scheduledDelayMilliseconds  = scheduledDelayMilliseconds;
            this.exporterTimeoutMilliseconds = exporterTimeoutMilliseconds;
            this.maxExportBatchSize          = maxExportBatchSize;
            this.exporterThread              = new Thread(new ThreadStart(this.ExporterProc))
            {
                IsBackground = true,
                Name         = $"OpenTelemetry-{nameof(BatchExportProcessor<T>)}-{exporter.GetType().Name}",
            };
            this.exporterThread.Start();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseExportProcessor{T}"/> class.
        /// </summary>
        /// <param name="exporter">Exporter instance.</param>
        protected BaseExportProcessor(BaseExporter <T> exporter)
        {
            Guard.Null(exporter, nameof(exporter));

            this.exporter = exporter;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseExportProcessor{T}"/> class.
        /// </summary>
        /// <param name="exporter">Exporter instance.</param>
        protected BaseExportProcessor(BaseExporter <T> exporter)
        {
            Guard.ThrowIfNull(exporter);

            this.exporter = exporter;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleExportProcessor{T}"/> class.
 /// </summary>
 /// <param name="exporter">Exporter instance.</param>
 public SimpleExportProcessor(BaseExporter <T> exporter)
     : base(exporter)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseExportProcessor{T}"/> class.
 /// </summary>
 /// <param name="exporter">Exporter instance.</param>
 public BaseExportProcessor(BaseExporter <T> exporter)
 {
     this.exporter = exporter ?? throw new ArgumentNullException(nameof(exporter));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReentrantExportProcessor{T}"/> class.
 /// </summary>
 /// <param name="exporter">Exporter instance.</param>
 public ReentrantExportProcessor(BaseExporter <T> exporter)
     : base(exporter)
 {
 }
 public SimpleActivityExportProcessor(BaseExporter <Activity> exporter)
     : base(exporter)
 {
 }
Example #11
0
 public SimpleLogRecordExportProcessor(BaseExporter <LogRecord> exporter)
     : base(exporter)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleExportProcessor{T}"/> class.
 /// </summary>
 /// <param name="exporter">Exporter instance.</param>
 protected SimpleExportProcessor(BaseExporter <T> exporter)
     : base(exporter)
 {
 }