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

[rake] shutdown tracer after execution #487

Merged
merged 3 commits into from
Jul 25, 2018

Conversation

kissrobber
Copy link
Contributor

@kissrobber kissrobber commented Jul 16, 2018

This sample doesn't seem to be working https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md#rake
Rake task process exits before flushing.

@pawelchcki pawelchcki self-requested a review July 16, 2018 14:49
@pawelchcki pawelchcki added bug Involves a bug integrations Involves tracing integrations labels Jul 16, 2018
Copy link
Contributor

@pawelchcki pawelchcki left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @kissrobber!
Looks really good.

I've added a few small comments about reducing code duplication and ensuring the traces are flushed even when exceptions are thrown.

Additionally a few tests verifying new behavior would future proof these changes.

Thanks!

super
annotate_invoke!(span, args)
end
tracer.shutdown! if tracer.active_span.nil? && ::Rake.application.top_level_tasks.include?(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to extract this to a separate method? So that there will be less duplication with def execute.

super
annotate_execute!(span, args)
end
tracer.shutdown! if tracer.active_span.nil? && ::Rake.application.top_level_tasks.include?(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good!
It would be great to have some tests for this new behavior.

I think also this could be put in ensure block so that even when task throws an exception we will still be able to flush the trace with info about that exception.

@@ -48,7 +50,7 @@ def annotate_execute!(span, args)
end

def quantize_args(args)
quantize_options = Datadog.configuration[:rake][:quantize][:args]
quantize_options = configuration[:quantize][:args]
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@kissrobber
Copy link
Contributor Author

kissrobber commented Jul 17, 2018

@pawelchcki Hi!
Could you help me to fix this failure?
https://circleci.com/gh/DataDog/dd-trace-rb/8957

Why this test failed 😿

@delner
Copy link
Contributor

delner commented Jul 17, 2018

@kissrobber Sometimes that test flakes out (it tests some kind of throughput.) I'll re-run this for you.

@kissrobber
Copy link
Contributor Author

@pawelchcki @delner Hi, I changed this PR accoding to your comments.
Thanks

@pawelchcki pawelchcki added this to the 0.14.0 milestone Jul 25, 2018
Copy link
Contributor

@pawelchcki pawelchcki left a comment

Choose a reason for hiding this comment

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

@kissrobber Thanks for this awesome contribution!

@pawelchcki pawelchcki merged commit dfde097 into DataDog:master Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants