Failures:
1) DdtraceWrapper wrap multiple :methods wraps with all the available args applicable to each method
Failure/Error: expect(Datadog::Tracing).to receive(:trace).with('multi_span', service: ENV['DD_TRACE_METHOD_WRAPPER_SERVICE'], resource: 'DatadogTraceWrapperSpec#multi_wrapped_value_1')
(Datadog::Tracing).trace("multi_span", {:resource=>"DatadogTraceWrapperSpec#multi_wrapped_value_1", :service=>"rspec"})
expected: 1 time with arguments: ("multi_span", {:resource=>"DatadogTraceWrapperSpec#multi_wrapped_value_1", :service=>"rspec"})
received: 2 times with arguments: ("multi_span", {:resource=>"DatadogTraceWrapperSpec#multi_wrapped_value_1", :service=>"rspec"})
# ./spec/datadog_trace_wrapper_spec.rb:65:in `block (3 levels) in <top (required)>'
Finished in 0.01564 seconds (files took 0.33626 seconds to load)
5 examples, 1 failure
Failed examples:
rspec ./spec/datadog_trace_wrapper_spec.rb:64 # DdtraceWrapper wrap multiple :methods wraps with all the available args applicable to each method
The issue stems from the resource being set for the first method if the passed in value is falsey, and then the value being used in subsequent methods due to the memoisation:
ddtrace-rb-method-wrapper/lib/datadog_trace_wrapper.rb
Line 28 in 2ee71cd
I've got a branch with a reproducing spec: master...joshuay03:ddtrace-rb-method-wrapper:multi-wrapped-resources
Failure
Note that I had to update some of the API usage to get the specs to run with the latest 1.x version of
ddtrace.While I'm here, are there any plans to support
ddtracev2 (renamed todatadog)?