Skip to content

Commit

Permalink
feat: add comments
Browse files Browse the repository at this point in the history
Signed-off-by: zengxilong <zengxilonglh@gmail.com>
  • Loading branch information
zengxilong committed Sep 1, 2022
1 parent 5e5c107 commit 18d258b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 3 additions & 0 deletions opentelemetry-jaeger/src/exporter/config/agent.rs
Expand Up @@ -234,6 +234,9 @@ impl AgentPipeline {

/// Assign the batch span processor for the exporter pipeline.
///
/// If a simple span processor is used by [`install_simple`][AgentPipeline::install_simple]
/// or [`build_simple`][AgentPipeline::install_simple], then this config will not be valid.
///
/// # Examples
/// Set max queue size.
/// ```rust
Expand Down
26 changes: 21 additions & 5 deletions opentelemetry-sdk/src/trace/span_processor.rs
Expand Up @@ -555,31 +555,47 @@ impl Default for BatchConfig {
}

impl BatchConfig {
/// Set max queue size for batch config
/// Set max_queue_size for [`BatchConfig`].
/// It's the maximum queue size to buffer spans for delayed processing.
/// If the queue gets full it will drops the spans.
/// The default value of is 2048.
pub fn with_max_queue_size(mut self, max_queue_size: usize) -> Self {
self.max_queue_size = max_queue_size;
self
}

/// Set max export batch size for batch config
/// Set max_export_batch_size for [`BatchConfig`].
/// It's the maximum number of spans to process in a single batch. If there are
/// more than one batch worth of spans then it processes multiple batches
/// of spans one batch after the other without any delay. The default value
/// is 512.
pub fn with_max_export_batch_size(mut self, max_export_batch_size: usize) -> Self {
self.max_export_batch_size = max_export_batch_size;
self
}

/// Set max concurrent exports for batch config
/// Set max_concurrent_exports for [`BatchConfig`].
/// It's the maximum number of concurrent exports.
/// Limits the number of spawned tasks for exports and thus memory consumed by an exporter.
/// The default value is 1.
/// IF the max_concurrent_exports value is default value, it will cause exports to be performed
/// synchronously on the BatchSpanProcessor task.
pub fn with_max_concurrent_exports(mut self, max_concurrent_exports: usize) -> Self {
self.max_concurrent_exports = max_concurrent_exports;
self
}

/// Set scheduled delay duration for batch config
/// Set scheduled_delay_duration for [`BatchConfig`].
/// It's the delay interval in milliseconds between two consecutive processing of batches.
/// The default value is 5000 milliseconds.
pub fn with_scheduled_delay(mut self, scheduled_delay: Duration) -> Self {
self.scheduled_delay = scheduled_delay;
self
}

/// Set max export timeout for batch config
/// Set max_export_timeout for [`BatchConfig`].
/// It's the maximum duration to export a batch of data.
/// The The default value is 30000 milliseconds.
pub fn with_max_export_timeout(mut self, max_export_timeout: Duration) -> Self {
self.max_export_timeout = max_export_timeout;
self
Expand Down

0 comments on commit 18d258b

Please sign in to comment.