test/instrumentation/dalli_test.rb in instana-1.9.7 vs test/instrumentation/dalli_test.rb in instana-1.10.0.slimfast

- old
+ new

@@ -22,22 +22,19 @@ result = @dc.get(:instana) end assert_equal :boom, result - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -58,22 +55,19 @@ result = @dc.set(:instana, :rocks) end assert result.is_a?(Integer) - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -95,22 +89,19 @@ result = @dc.replace(:instana, :rocks) end assert result.is_a?(Integer) - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -132,22 +123,19 @@ result = @dc.delete(:instana) end assert_equal true, result - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -169,22 +157,19 @@ result = @dc.incr(:counter, 1, nil, 0) end assert_equal 1, result - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -206,22 +191,19 @@ result = @dc.decr(:counter, 1, nil, 0) end assert_equal 0, result - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command) @@ -242,21 +224,18 @@ ::Instana.tracer.start_or_continue_trace(:dalli_test) do @dc.get_multi(:one, :two, :three, :four) end - traces = Instana.processor.queued_traces - assert_equal 1, traces.length - trace = traces.first + spans = ::Instana.processor.queued_spans + assert_equal 2, spans.length - # Excon validation - assert_equal 2, trace.spans.length - spans = trace.spans.to_a - first_span = spans[0] - second_span = spans[1] + first_span = spans[1] + second_span = spans[0] - assert_equal :dalli_test, first_span.name - assert_equal :memcache, second_span.name + validate_sdk_span(first_span, {:name => :dalli_test, :type => :intermediate}) + + assert_equal :memcache, second_span[:n] assert_equal false, second_span.key?(:error) assert second_span[:p] == first_span[:s] assert first_span[:t] == first_span[:s] assert second_span[:data].key?(:memcache) assert second_span[:data][:memcache].key?(:command)