-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose log batchconfig #1471
Expose log batchconfig #1471
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1471 +/- ##
=======================================
+ Coverage 60.8% 61.3% +0.4%
=======================================
Files 146 146
Lines 19230 19459 +229
=======================================
+ Hits 11711 11947 +236
+ Misses 7519 7512 -7 ☔ View full report in Codecov by Sentry. |
I believe BatchLogProcessorBuilder is still required to configure LoggerProvider/TracerProvider with an instance of BatchSpanProcessor. Something like this: let batch = BatchSpanProcessor::builder(
stdout::new_simple_exporter(), // Using a simple stdout exporter
trace::runtime::Tokio, // Using Tokio runtime
)
.with_max_queue_size(2048) // Optional: Configure max queue size
.with_scheduled_delay(std::time::Duration::from_secs(5)) // Optional: Configure scheduled delay
.build();
// Build the TracerProvider with the configured BatchSpanProcessor
let provider = TracerProvider::builder()
.with_span_processor(batch)
.build();
I thought |
I might be wrong here, but if I look at the specs https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#batch-logrecord-processor for both Batch Span Processor and Batch LogRecord Processor I cannot find any references to |
Fixing copy paste leftovers
Ok yeah. I don't have the background for using non-standard |
Thinking about this again, I agree it would make sense to remove these functions from let batch_config = BatchConfig::builder()
.with_max_queue_size(200)
.with_scheduled_delay(std::time::Duration::from_secs(5))
.build();
let batch_processor = BatchLogProcessor::builder(exporter, runtime)
.with_batch_config(batch_config)
.build();
provider = LoggerProvider::builder().with_log_processor(batch_processor); Good to have a minimal API/SDK surface, and remove redundant configuration options. Do you want to create separate PR for both spans and logs for this, as it would be a breaking change for the customer already using this interface? |
Yes, a new PR sounds like the way forward here. I will look into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the changes are consistent with the BatchSpanProcessor. There are some cleanups discussed in the comments, which can be done as separate PR. Thanks for the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can we also add CHANGELOGS?
Will do! |
@TommyCpp Entry in the CHANGELOG was added. |
Thanks for your contribution! Would love to see more contribs, if you are interested! |
Support for OTEL_BLRP_* environment variables has been introduced in the rust client. PR: open-telemetry/opentelemetry-rust#1471
Fixes #1468
Design discussion issue (if applicable) #
Changes
Allows configuring the
BatchLogProcessor<T>
with standard environment variables or in code viaOtlpLogPipeline::with_batch_config
.The change is inspired from OtlpTracePipeline::with_batch_config
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changesExtra discussion
with_max_queue_size
,with_scheduled_delay
,with_max_timeout
andwith_max_export_batch_size
functions onBatchLogProcessorBuilder<E, R>
? Same question applies toBatchSpanProcessorBuilder<E, R>
.max_export_batch_size
(OTEL_BLRP_MAX_EXPORT_BATCH_SIZE
) needs to be less than or equal tomax_queue_size
(OTEL_BLRP_MAX_QUEUE_SIZE
) is enforced in multiple places:BatchConfig
implementation of theDefault
traitwith_max_export_batch_size
function ofBatchLogProcessorBuilder<E, R>
and not at all in
BatchConfig
(I did it like this to mirror the setup from the BatchConfig of the SpanProcessor). Would it be a better idea to introduce aBatchConfigBuilder
?OTEL_BSP_EXPORT_TIMEOUT_MILLIS
andOTEL_BSP_SCHEDULE_DELAY_MILLIS
. I replicated the same setup in this PR for the sake of consistency. Do we want to allow configuration from non-standard environment variables when standard ones exist?