Skip to content

Commit

Permalink
Merge pull request #742 from Redapted/master
Browse files Browse the repository at this point in the history
Use original return values for rake methods
  • Loading branch information
delner authored Apr 29, 2019
2 parents 1380263 + 06d2186 commit effb03b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/ddtrace/contrib/rake/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def invoke(*args)
return super unless enabled?

tracer.trace(Ext::SPAN_INVOKE, span_options) do |span|
super
annotate_invoke!(span, args)
super.tap { annotate_invoke!(span, args) }
end
ensure
shutdown_tracer!
Expand All @@ -27,8 +26,7 @@ def execute(args = nil)
return super unless enabled?

tracer.trace(Ext::SPAN_EXECUTE, span_options) do |span|
super
annotate_execute!(span, args)
super.tap { annotate_execute!(span, args) }
end
ensure
shutdown_tracer!
Expand Down
5 changes: 5 additions & 0 deletions spec/ddtrace/contrib/rake/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ def reset_task!(task_name)

before(:each) { define_task! }

it 'returns task return value' do
allow(spy).to receive(:call)
expect(task.invoke(*args)).to contain_exactly(task_body)
end

context 'without args' do
it_behaves_like 'a single task execution' do
describe '\'rake.invoke\' span tags' do
Expand Down

0 comments on commit effb03b

Please sign in to comment.