instana 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -0
- data/.gitignore +1 -0
- data/.travis.yml +24 -2
- data/Gemfile +2 -22
- data/README.md +1 -1
- data/Rakefile +15 -0
- data/Tracing.md +29 -2
- data/gemfiles/libraries.gemfile +50 -0
- data/gemfiles/rails32.gemfile +45 -0
- data/gemfiles/rails42.gemfile +44 -0
- data/gemfiles/rails50.gemfile +44 -0
- data/instana.gemspec +6 -8
- data/lib/instana/config.rb +7 -5
- data/lib/instana/frameworks/instrumentation/abstract_mysql_adapter.rb +55 -0
- data/lib/instana/frameworks/instrumentation/action_controller.rb +105 -0
- data/lib/instana/frameworks/instrumentation/active_record.rb +22 -0
- data/lib/instana/frameworks/instrumentation/mysql2_adapter.rb +81 -0
- data/lib/instana/frameworks/instrumentation/mysql_adapter.rb +56 -0
- data/lib/instana/frameworks/instrumentation/postgresql_adapter.rb +71 -0
- data/lib/instana/frameworks/rails.rb +5 -0
- data/lib/instana/test.rb +40 -0
- data/lib/instana/tracer.rb +19 -0
- data/lib/instana/tracing/span.rb +3 -3
- data/lib/instana/version.rb +1 -1
- data/log/.keep +0 -0
- data/test/agent/agent_test.rb +139 -0
- data/test/apps/cuba.rb +15 -0
- data/test/apps/roda.rb +10 -0
- data/test/apps/sinatra.rb +5 -0
- data/test/config_test.rb +17 -0
- data/test/frameworks/cuba_test.rb +44 -0
- data/test/frameworks/rack_test.rb +152 -0
- data/test/frameworks/rails/actioncontroller_test.rb +123 -0
- data/test/frameworks/rails/activerecord3_test.rb +134 -0
- data/test/frameworks/rails/activerecord4_test.rb +134 -0
- data/test/frameworks/rails/activerecord5_test.rb +90 -0
- data/test/frameworks/roda_test.rb +44 -0
- data/test/frameworks/sinatra_test.rb +44 -0
- data/test/instana_test.rb +27 -0
- data/test/instrumentation/dalli_test.rb +274 -0
- data/test/instrumentation/excon_test.rb +171 -0
- data/test/instrumentation/net-http_test.rb +140 -0
- data/test/instrumentation/rest-client_test.rb +61 -0
- data/test/models/block.rb +18 -0
- data/test/servers/rackapp_6511.rb +20 -0
- data/test/servers/rails_3205.rb +95 -0
- data/test/test_helper.rb +39 -0
- data/test/tracing/custom_test.rb +143 -0
- data/test/tracing/id_management_test.rb +96 -0
- data/test/tracing/opentracing_test.rb +377 -0
- data/test/tracing/trace_test.rb +50 -0
- data/test/tracing/tracer_async_test.rb +298 -0
- data/test/tracing/tracer_test.rb +202 -0
- metadata +114 -4
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class InstanaTest < Minitest::Test
|
4
|
+
def test_that_it_has_a_version_number
|
5
|
+
refute_nil ::Instana::VERSION
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_that_it_has_a_logger
|
9
|
+
refute_nil ::Instana.logger
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_that_it_has_an_agent
|
13
|
+
refute_nil ::Instana.agent
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_that_it_has_a_collector
|
17
|
+
refute_nil ::Instana.collector
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_that_it_has_a_tracer
|
21
|
+
refute_nil ::Instana.tracer
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_that_it_has_a_config
|
25
|
+
refute_nil ::Instana.config
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DalliTest < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@memcached_host = ENV['MEMCACHED_HOST'] || '127.0.0.1:11211'
|
6
|
+
@dc = Dalli::Client.new(@memcached_host, :namespace => "instana_test")
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_config_defaults
|
10
|
+
assert ::Instana.config[:dalli].is_a?(Hash)
|
11
|
+
assert ::Instana.config[:dalli].key?(:enabled)
|
12
|
+
assert_equal true, ::Instana.config[:dalli][:enabled]
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_basic_get
|
16
|
+
clear_all!
|
17
|
+
|
18
|
+
@dc.set(:instana, :boom)
|
19
|
+
|
20
|
+
result = nil
|
21
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
22
|
+
result = @dc.get(:instana)
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_equal :boom, result
|
26
|
+
|
27
|
+
traces = Instana.processor.queued_traces
|
28
|
+
assert_equal 1, traces.count
|
29
|
+
trace = traces.first
|
30
|
+
|
31
|
+
# Excon validation
|
32
|
+
assert_equal 2, trace.spans.count
|
33
|
+
spans = trace.spans.to_a
|
34
|
+
first_span = spans[0]
|
35
|
+
second_span = spans[1]
|
36
|
+
|
37
|
+
assert_equal :dalli_test, first_span.name
|
38
|
+
assert_equal :memcache, second_span.name
|
39
|
+
assert_equal false, second_span.key?(:error)
|
40
|
+
assert second_span[:p] == first_span[:s]
|
41
|
+
assert first_span[:t] == first_span[:s]
|
42
|
+
assert second_span[:data].key?(:memcache)
|
43
|
+
assert second_span[:data][:memcache].key?(:command)
|
44
|
+
assert_equal :get, second_span[:data][:memcache][:command]
|
45
|
+
assert second_span[:data][:memcache].key?(:key)
|
46
|
+
assert_equal :instana, second_span[:data][:memcache][:key]
|
47
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
48
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
49
|
+
assert second_span[:data][:memcache].key?(:server)
|
50
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_basic_set
|
54
|
+
clear_all!
|
55
|
+
|
56
|
+
result = nil
|
57
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
58
|
+
result = @dc.set(:instana, :rocks)
|
59
|
+
end
|
60
|
+
|
61
|
+
assert result.is_a?(Integer)
|
62
|
+
|
63
|
+
traces = Instana.processor.queued_traces
|
64
|
+
assert_equal 1, traces.count
|
65
|
+
trace = traces.first
|
66
|
+
|
67
|
+
# Excon validation
|
68
|
+
assert_equal 2, trace.spans.count
|
69
|
+
spans = trace.spans.to_a
|
70
|
+
first_span = spans[0]
|
71
|
+
second_span = spans[1]
|
72
|
+
|
73
|
+
assert_equal :dalli_test, first_span.name
|
74
|
+
assert_equal :memcache, second_span.name
|
75
|
+
assert_equal false, second_span.key?(:error)
|
76
|
+
assert second_span[:p] == first_span[:s]
|
77
|
+
assert first_span[:t] == first_span[:s]
|
78
|
+
assert second_span[:data].key?(:memcache)
|
79
|
+
assert second_span[:data][:memcache].key?(:command)
|
80
|
+
assert_equal :set, second_span[:data][:memcache][:command]
|
81
|
+
assert second_span[:data][:memcache].key?(:key)
|
82
|
+
assert_equal :instana, second_span[:data][:memcache][:key]
|
83
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
84
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
85
|
+
assert second_span[:data][:memcache].key?(:server)
|
86
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_replace
|
90
|
+
clear_all!
|
91
|
+
|
92
|
+
@dc.set(:instana, :rocks)
|
93
|
+
result = nil
|
94
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
95
|
+
result = @dc.replace(:instana, :rocks)
|
96
|
+
end
|
97
|
+
|
98
|
+
assert result.is_a?(Integer)
|
99
|
+
|
100
|
+
traces = Instana.processor.queued_traces
|
101
|
+
assert_equal 1, traces.count
|
102
|
+
trace = traces.first
|
103
|
+
|
104
|
+
# Excon validation
|
105
|
+
assert_equal 2, trace.spans.count
|
106
|
+
spans = trace.spans.to_a
|
107
|
+
first_span = spans[0]
|
108
|
+
second_span = spans[1]
|
109
|
+
|
110
|
+
assert_equal :dalli_test, first_span.name
|
111
|
+
assert_equal :memcache, second_span.name
|
112
|
+
assert_equal false, second_span.key?(:error)
|
113
|
+
assert second_span[:p] == first_span[:s]
|
114
|
+
assert first_span[:t] == first_span[:s]
|
115
|
+
assert second_span[:data].key?(:memcache)
|
116
|
+
assert second_span[:data][:memcache].key?(:command)
|
117
|
+
assert_equal :replace, second_span[:data][:memcache][:command]
|
118
|
+
assert second_span[:data][:memcache].key?(:key)
|
119
|
+
assert_equal :instana, second_span[:data][:memcache][:key]
|
120
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
121
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
122
|
+
assert second_span[:data][:memcache].key?(:server)
|
123
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_delete
|
127
|
+
clear_all!
|
128
|
+
|
129
|
+
@dc.set(:instana, :rocks)
|
130
|
+
result = nil
|
131
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
132
|
+
result = @dc.delete(:instana)
|
133
|
+
end
|
134
|
+
|
135
|
+
assert_equal true, result
|
136
|
+
|
137
|
+
traces = Instana.processor.queued_traces
|
138
|
+
assert_equal 1, traces.count
|
139
|
+
trace = traces.first
|
140
|
+
|
141
|
+
# Excon validation
|
142
|
+
assert_equal 2, trace.spans.count
|
143
|
+
spans = trace.spans.to_a
|
144
|
+
first_span = spans[0]
|
145
|
+
second_span = spans[1]
|
146
|
+
|
147
|
+
assert_equal :dalli_test, first_span.name
|
148
|
+
assert_equal :memcache, second_span.name
|
149
|
+
assert_equal false, second_span.key?(:error)
|
150
|
+
assert second_span[:p] == first_span[:s]
|
151
|
+
assert first_span[:t] == first_span[:s]
|
152
|
+
assert second_span[:data].key?(:memcache)
|
153
|
+
assert second_span[:data][:memcache].key?(:command)
|
154
|
+
assert_equal :delete, second_span[:data][:memcache][:command]
|
155
|
+
assert second_span[:data][:memcache].key?(:key)
|
156
|
+
assert_equal :instana, second_span[:data][:memcache][:key]
|
157
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
158
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
159
|
+
assert second_span[:data][:memcache].key?(:server)
|
160
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_incr
|
164
|
+
clear_all!
|
165
|
+
|
166
|
+
result = nil
|
167
|
+
@dc.set(:counter, 0, nil, :raw => true)
|
168
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
169
|
+
result = @dc.incr(:counter, 1, nil, 0)
|
170
|
+
end
|
171
|
+
|
172
|
+
assert_equal 1, result
|
173
|
+
|
174
|
+
traces = Instana.processor.queued_traces
|
175
|
+
assert_equal 1, traces.count
|
176
|
+
trace = traces.first
|
177
|
+
|
178
|
+
# Excon validation
|
179
|
+
assert_equal 2, trace.spans.count
|
180
|
+
spans = trace.spans.to_a
|
181
|
+
first_span = spans[0]
|
182
|
+
second_span = spans[1]
|
183
|
+
|
184
|
+
assert_equal :dalli_test, first_span.name
|
185
|
+
assert_equal :memcache, second_span.name
|
186
|
+
assert_equal false, second_span.key?(:error)
|
187
|
+
assert second_span[:p] == first_span[:s]
|
188
|
+
assert first_span[:t] == first_span[:s]
|
189
|
+
assert second_span[:data].key?(:memcache)
|
190
|
+
assert second_span[:data][:memcache].key?(:command)
|
191
|
+
assert_equal :incr, second_span[:data][:memcache][:command]
|
192
|
+
assert second_span[:data][:memcache].key?(:key)
|
193
|
+
assert_equal :counter, second_span[:data][:memcache][:key]
|
194
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
195
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
196
|
+
assert second_span[:data][:memcache].key?(:server)
|
197
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_decr
|
201
|
+
clear_all!
|
202
|
+
|
203
|
+
result = nil
|
204
|
+
@dc.set(:counter, 0, nil, :raw => true)
|
205
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
206
|
+
result = @dc.decr(:counter, 1, nil, 0)
|
207
|
+
end
|
208
|
+
|
209
|
+
assert_equal 0, result
|
210
|
+
|
211
|
+
traces = Instana.processor.queued_traces
|
212
|
+
assert_equal 1, traces.count
|
213
|
+
trace = traces.first
|
214
|
+
|
215
|
+
# Excon validation
|
216
|
+
assert_equal 2, trace.spans.count
|
217
|
+
spans = trace.spans.to_a
|
218
|
+
first_span = spans[0]
|
219
|
+
second_span = spans[1]
|
220
|
+
|
221
|
+
assert_equal :dalli_test, first_span.name
|
222
|
+
assert_equal :memcache, second_span.name
|
223
|
+
assert_equal false, second_span.key?(:error)
|
224
|
+
assert second_span[:p] == first_span[:s]
|
225
|
+
assert first_span[:t] == first_span[:s]
|
226
|
+
assert second_span[:data].key?(:memcache)
|
227
|
+
assert second_span[:data][:memcache].key?(:command)
|
228
|
+
assert_equal :decr, second_span[:data][:memcache][:command]
|
229
|
+
assert second_span[:data][:memcache].key?(:key)
|
230
|
+
assert_equal :counter, second_span[:data][:memcache][:key]
|
231
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
232
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
233
|
+
assert second_span[:data][:memcache].key?(:server)
|
234
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_get_multi
|
238
|
+
clear_all!
|
239
|
+
|
240
|
+
@dc.set(:one, 1)
|
241
|
+
@dc.set(:three, 3)
|
242
|
+
|
243
|
+
::Instana.tracer.start_or_continue_trace(:dalli_test) do
|
244
|
+
@dc.get_multi(:one, :two, :three, :four)
|
245
|
+
end
|
246
|
+
|
247
|
+
traces = Instana.processor.queued_traces
|
248
|
+
assert_equal 1, traces.count
|
249
|
+
trace = traces.first
|
250
|
+
|
251
|
+
# Excon validation
|
252
|
+
assert_equal 2, trace.spans.count
|
253
|
+
spans = trace.spans.to_a
|
254
|
+
first_span = spans[0]
|
255
|
+
second_span = spans[1]
|
256
|
+
|
257
|
+
assert_equal :dalli_test, first_span.name
|
258
|
+
assert_equal :memcache, second_span.name
|
259
|
+
assert_equal false, second_span.key?(:error)
|
260
|
+
assert second_span[:p] == first_span[:s]
|
261
|
+
assert first_span[:t] == first_span[:s]
|
262
|
+
assert second_span[:data].key?(:memcache)
|
263
|
+
assert second_span[:data][:memcache].key?(:command)
|
264
|
+
assert_equal :get_multi, second_span[:data][:memcache][:command]
|
265
|
+
assert second_span[:data][:memcache].key?(:keys)
|
266
|
+
assert_equal "one, two, three, four", second_span[:data][:memcache][:keys]
|
267
|
+
assert second_span[:data][:memcache].key?(:namespace)
|
268
|
+
assert_equal 'instana_test', second_span[:data][:memcache][:namespace]
|
269
|
+
assert second_span[:data][:memcache].key?(:server)
|
270
|
+
assert_equal ENV['MEMCACHED_HOST'], second_span[:data][:memcache][:server]
|
271
|
+
assert second_span[:data][:memcache].key?(:hits)
|
272
|
+
assert_equal 2, second_span[:data][:memcache][:hits]
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ExconTest < Minitest::Test
|
4
|
+
def test_config_defaults
|
5
|
+
assert ::Instana.config[:excon].is_a?(Hash)
|
6
|
+
assert ::Instana.config[:excon].key?(:enabled)
|
7
|
+
assert_equal true, ::Instana.config[:excon][:enabled]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_basic_get
|
11
|
+
clear_all!
|
12
|
+
|
13
|
+
# A slight hack but webmock chokes with pipelined requests.
|
14
|
+
# Delete their excon middleware
|
15
|
+
Excon.defaults[:middlewares].delete ::WebMock::HttpLibAdapters::ExconAdapter
|
16
|
+
Excon.defaults[:middlewares].delete ::Excon::Middleware::Mock
|
17
|
+
|
18
|
+
url = "http://127.0.0.1:6511"
|
19
|
+
|
20
|
+
connection = Excon.new(url)
|
21
|
+
Instana.tracer.start_or_continue_trace('excon-test') do
|
22
|
+
connection.get(:path => '/?basic_get')
|
23
|
+
end
|
24
|
+
|
25
|
+
traces = Instana.processor.queued_traces
|
26
|
+
assert_equal 2, traces.count
|
27
|
+
rs_trace = traces[0]
|
28
|
+
http_trace = traces[1]
|
29
|
+
|
30
|
+
# Excon validation
|
31
|
+
assert_equal 2, http_trace.spans.count
|
32
|
+
spans = http_trace.spans.to_a
|
33
|
+
first_span = spans[0]
|
34
|
+
second_span = spans[1]
|
35
|
+
|
36
|
+
# Span name validation
|
37
|
+
assert_equal :sdk, first_span[:n]
|
38
|
+
assert_equal :"excon-test", first_span[:data][:sdk][:name]
|
39
|
+
assert_equal :excon, second_span[:n]
|
40
|
+
|
41
|
+
# first_span is the parent of second_span
|
42
|
+
assert_equal first_span.id, second_span[:p]
|
43
|
+
|
44
|
+
# data keys/values
|
45
|
+
refute_nil second_span.key?(:data)
|
46
|
+
refute_nil second_span[:data].key?(:http)
|
47
|
+
assert_equal "http://127.0.0.1:6511/", second_span[:data][:http][:url]
|
48
|
+
assert_equal 200, second_span[:data][:http][:status]
|
49
|
+
|
50
|
+
# excon backtrace included check
|
51
|
+
assert second_span.key?(:stack)
|
52
|
+
|
53
|
+
# Rack server trace validation
|
54
|
+
assert_equal 1, rs_trace.spans.count
|
55
|
+
rs_span = rs_trace.spans.to_a[0]
|
56
|
+
|
57
|
+
# Rack server trace should have the same trace ID
|
58
|
+
assert_equal http_trace.id, rs_span[:t].to_i
|
59
|
+
assert_equal rs_span[:p].to_i, second_span[:s]
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_basic_get_with_error
|
63
|
+
clear_all!
|
64
|
+
|
65
|
+
# A slight hack but webmock chokes with pipelined requests.
|
66
|
+
# Delete their excon middleware
|
67
|
+
Excon.defaults[:middlewares].delete ::WebMock::HttpLibAdapters::ExconAdapter
|
68
|
+
Excon.defaults[:middlewares].delete ::Excon::Middleware::Mock
|
69
|
+
|
70
|
+
url = "http://127.0.0.1:6500"
|
71
|
+
|
72
|
+
begin
|
73
|
+
connection = Excon.new(url)
|
74
|
+
Instana.tracer.start_or_continue_trace('excon-test') do
|
75
|
+
connection.get(:path => '/?basic_get')
|
76
|
+
end
|
77
|
+
rescue
|
78
|
+
end
|
79
|
+
|
80
|
+
traces = Instana.processor.queued_traces
|
81
|
+
assert_equal 1, traces.count
|
82
|
+
http_trace = traces.first
|
83
|
+
|
84
|
+
# Excon validation
|
85
|
+
assert_equal 2, http_trace.spans.count
|
86
|
+
spans = http_trace.spans.to_a
|
87
|
+
first_span = spans[0]
|
88
|
+
second_span = spans[1]
|
89
|
+
|
90
|
+
# Span name validation
|
91
|
+
assert_equal :sdk, first_span[:n]
|
92
|
+
assert_equal :"excon-test", first_span[:data][:sdk][:name]
|
93
|
+
assert_equal :excon, second_span[:n]
|
94
|
+
|
95
|
+
# first_span is the parent of second_span
|
96
|
+
assert_equal first_span.id, second_span[:p]
|
97
|
+
|
98
|
+
# data keys/values
|
99
|
+
refute_nil second_span.key?(:data)
|
100
|
+
refute_nil second_span[:data].key?(:http)
|
101
|
+
assert_equal "http://127.0.0.1:6500/", second_span[:data][:http][:url]
|
102
|
+
assert_equal nil, second_span[:data][:http][:status]
|
103
|
+
|
104
|
+
# excon backtrace included check
|
105
|
+
assert second_span.key?(:stack)
|
106
|
+
|
107
|
+
# error validation
|
108
|
+
assert_equal true, second_span[:error]
|
109
|
+
#assert_equal 1, second_span[:ec]
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_pipelined_requests
|
113
|
+
clear_all!
|
114
|
+
|
115
|
+
# A slight hack but webmock chokes with pipelined requests.
|
116
|
+
# Delete their excon middleware
|
117
|
+
Excon.defaults[:middlewares].delete ::WebMock::HttpLibAdapters::ExconAdapter
|
118
|
+
Excon.defaults[:middlewares].delete ::Excon::Middleware::Mock
|
119
|
+
|
120
|
+
url = "http://127.0.0.1:6511"
|
121
|
+
|
122
|
+
connection = Excon.new(url)
|
123
|
+
request = { :method => :get, :path => '/?pipelined_request' }
|
124
|
+
Instana.tracer.start_or_continue_trace('excon-test') do
|
125
|
+
connection.requests([request, request, request])
|
126
|
+
end
|
127
|
+
|
128
|
+
traces = Instana.processor.queued_traces
|
129
|
+
assert_equal 4, traces.count
|
130
|
+
http_trace = traces[3]
|
131
|
+
|
132
|
+
# Excon validation
|
133
|
+
assert_equal 4, http_trace.spans.count
|
134
|
+
spans = http_trace.spans.to_a
|
135
|
+
first_span = spans[0]
|
136
|
+
second_span = spans[1]
|
137
|
+
third_span = spans[2]
|
138
|
+
fourth_span = spans[3]
|
139
|
+
|
140
|
+
# Span name validation
|
141
|
+
assert_equal :sdk, first_span[:n]
|
142
|
+
assert_equal :"excon-test", first_span[:data][:sdk][:name]
|
143
|
+
assert_equal :excon, second_span[:n]
|
144
|
+
assert_equal :excon, third_span[:n]
|
145
|
+
assert_equal :excon, fourth_span[:n]
|
146
|
+
|
147
|
+
# first_span is the parent of second/third/fourth_span
|
148
|
+
assert_equal first_span.id, second_span[:p]
|
149
|
+
assert_equal first_span.id, third_span[:p]
|
150
|
+
assert_equal first_span.id, fourth_span[:p]
|
151
|
+
|
152
|
+
# data keys/values
|
153
|
+
refute_nil second_span.key?(:data)
|
154
|
+
refute_nil second_span[:data].key?(:http)
|
155
|
+
assert_equal "http://127.0.0.1:6511/", second_span[:data][:http][:url]
|
156
|
+
assert_equal 200, second_span[:data][:http][:status]
|
157
|
+
assert second_span.key?(:stack)
|
158
|
+
|
159
|
+
refute_nil third_span.key?(:data)
|
160
|
+
refute_nil third_span[:data].key?(:http)
|
161
|
+
assert_equal "http://127.0.0.1:6511/", third_span[:data][:http][:url]
|
162
|
+
assert_equal 200, third_span[:data][:http][:status]
|
163
|
+
assert third_span.key?(:stack)
|
164
|
+
|
165
|
+
refute_nil fourth_span.key?(:data)
|
166
|
+
refute_nil fourth_span[:data].key?(:http)
|
167
|
+
assert_equal "http://127.0.0.1:6511/", fourth_span[:data][:http][:url]
|
168
|
+
assert_equal 200, fourth_span[:data][:http][:status]
|
169
|
+
assert fourth_span.key?(:stack)
|
170
|
+
end
|
171
|
+
end
|