-
Notifications
You must be signed in to change notification settings - Fork 247
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
Batch span processor #74
Batch span processor #74
Conversation
@fbogsany want to have a look? Looking for inspiration for non racy more thready tests. |
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
c3430b7
to
7ae643d
Compare
I signed it |
1 similar comment
I signed it |
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
sdk/lib/opentelemetry/sdk/trace/export/batch_sampled_span_processor.rb
Outdated
Show resolved
Hide resolved
@rdooley did you want to finish this off ? |
@ibawt sure thing, I'll get right on this after getting the CI running for sdk as well as api |
0ae407c
to
5b63dd5
Compare
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
Slight divergence from suggestion in work method to account for the start and immediate shutdown case (yay test coverage)
* tests needed, first passes were failing so checking in while I get coffee
f047af1
to
f033bed
Compare
sdk/test/opentelemetry/sdk/trace/export/batch_span_processor_test.rb
Outdated
Show resolved
Hide resolved
* raise not log on misconfig
I pushed up a change that I think cleans up the code a little, and fixes a couple bugs. Namely, the timeout argument to |
I pushed a change to address some of these comments.
result_code = @exporter.export(batch) | ||
while result_code == FAILED_RETRYABLE && retries < @export_retry_attempts | ||
sleep(0.1 * retries) | ||
@export_attempts.times do |retries| |
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.
slick
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.
This looks pretty awesome. I have a few questions, mainly about configuration. Will users be setting this up manually (ie will they calling BatchSpanProcessor.new(my_exporter, schedule_delay_millis: 100)
or will setup rely on the SDK configuration. If the latter is true, should we add the configuration here. If not, then the configuration questions are probably irrelevant.
result_code = @exporter.export(batch) | ||
return result_code unless result_code == FAILED_RETRYABLE | ||
|
||
sleep(0.1 * retries) |
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.
Is the wait between retries something that should be configurable? Should it be a parameter to the constructor like wait_time_millis
and friends?
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.
The spec says nothing about limiting retries, or how backoff should be handled. I'm not a huge fan of adding too many knobs here. Is there a way we could punt all of the backoff & retry logic to the user, with a reasonable default? I.e. allow them to provide a proc.
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.
I think we can punt for now and consider allowing a user specified proc in the future.
MAX_EXPORT_ATTEMPTS = 5 | ||
private_constant(:SCHEDULE_DELAY_MILLIS, :MAX_QUEUE_SIZE, :MAX_EXPORT_BATCH_SIZE, :MAX_EXPORT_ATTEMPTS) | ||
|
||
def initialize(exporter:, |
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.
Do we expect these settings to come from configuration utlimately? If so, does it make sense to have the constants (above) and default configuration values in addition, or do we only need the defaults in one place?
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.
Defaults should live in one place. How do you see configuration working for this?
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.
I was wondering if the user would be instantiating the BatchSpanProcessor themselves, or if the SDK would instantiate it on their behalf. If it's the user, then I think things are fine as they are. If it's the SDK, then perhaps we should add options to TraceConfig that default to the values we have in the constants.
I renamed |
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.
We can talk about configuration later and see if it makes sense. I'm not sure that it does, and I don't think we need to settle it in this PR.
For context, the (draft) spec is here: https://github.com/open-telemetry/opentelemetry-specification/pull/205/files