Skip to content
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

Merged
merged 23 commits into from
Sep 25, 2019

Conversation

ibawt
Copy link
Contributor

@ibawt ibawt commented Sep 10, 2019

@ibawt
Copy link
Contributor Author

ibawt commented Sep 11, 2019

@fbogsany want to have a look? Looking for inspiration for non racy more thready tests.

@ibawt ibawt changed the title wip wip - batched sampled processor Sep 11, 2019
@rdooley rdooley force-pushed the batched-sampled-processor branch from c3430b7 to 7ae643d Compare September 13, 2019 17:33
@rdooley
Copy link
Contributor

rdooley commented Sep 13, 2019

I signed it

1 similar comment
@rdooley
Copy link
Contributor

rdooley commented Sep 13, 2019

I signed it

@ibawt
Copy link
Contributor Author

ibawt commented Sep 19, 2019

@rdooley did you want to finish this off ?

@rdooley
Copy link
Contributor

rdooley commented Sep 19, 2019

@ibawt sure thing, I'll get right on this after getting the CI running for sdk as well as api

@rdooley rdooley force-pushed the batched-sampled-processor branch from 0ae407c to 5b63dd5 Compare September 19, 2019 19:57
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
@rdooley rdooley force-pushed the batched-sampled-processor branch from f047af1 to f033bed Compare September 23, 2019 15:46
sdk/.rubocop.yml Outdated Show resolved Hide resolved
@fbogsany
Copy link
Contributor

I pushed up a change that I think cleans up the code a little, and fixes a couple bugs. Namely, the timeout argument to @condition.wait should be in seconds, and we treated it as milliseconds. That's what turned your laptop into a jet. And that meant the second break wasn't necessary. I switched the break for a return (TIL about break, or relearn, I guess) and moved the flush call to the shutdown method.

@fbogsany fbogsany changed the title wip - batched sampled processor Batch span processor Sep 24, 2019
@fbogsany fbogsany marked this pull request as ready for review September 24, 2019 22:10
@fbogsany fbogsany dismissed their stale review September 24, 2019 22:11

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|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slick

Copy link
Member

@mwear mwear left a 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)
Copy link
Member

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_millisand friends?

Copy link
Contributor

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.

Copy link
Member

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:,
Copy link
Member

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?

Copy link
Contributor

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?

Copy link
Member

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.

@fbogsany
Copy link
Contributor

I renamed on_end to on_finish and added some error logging at export. I'm not sure how configuration should work. If you have ideas @mwear, let me know and we can try to implement them in this PR, or we can punt it for now and deal with configuration in a separate PR.

Copy link
Member

@mwear mwear left a 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.

@fbogsany fbogsany merged commit 645d99c into open-telemetry:master Sep 25, 2019
@fbogsany fbogsany deleted the batched-sampled-processor branch September 25, 2019 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants