instana 1.10.8 → 1.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 684dee7f05eb5f97c5a798ecbcbc2f3dc64a55399111684416c9c0322f064e7a
4
- data.tar.gz: 6112a16e4bcc2e25806472b5d92dfeaa03927af40a0a163a51d4ec8a387cef7e
3
+ metadata.gz: 799531344ea9b755a3a2ac8358f4f865f048c87f1369ae44b71d3ac0ebbf576c
4
+ data.tar.gz: e971ec9577aec2396db65c095ce17b6347b4cc3f602d72e975d7602782afd265
5
5
  SHA512:
6
- metadata.gz: 37bc36f94b938bf57384191c673d952ad8b9a7d2ed7cefe89b07ac4d23dd5d8e0d364365f1d1021c35a1f81a85ee7588df6239c509cba41f2f6ffb3070e003a0
7
- data.tar.gz: 31e1dc82d98ea8aee566044803c629e03a3a293b508c5a70ebd69b561d7d4cd87b0c79546767500d77a66fb61b7703b199072a20713d6fab1f4f985b9df59e64
6
+ metadata.gz: 1443d5dff0ce3364b164de6062ee75a50882bacd433fbad034bb2353bbac462deaab77610c16c3235cd5114b2f8c10aa7c47603f35821afe39790011801960b0
7
+ data.tar.gz: e429a228dbd9706d45e6fdcda03349c11843ad5bcb80440d4e013f994c02d9e6b42f434c7dcbb84428b6fcabb5cc16c7dc4768ee0eecad65db4be81ae103e651
data/Rakefile CHANGED
@@ -13,15 +13,15 @@ Rake::TestTask.new(:test) do |t|
13
13
  if ENV.key?('BUNDLE_GEMFILE')
14
14
  case File.basename(ENV['BUNDLE_GEMFILE']).split('.').first
15
15
  when /rails50/
16
- t.test_files = %w(test/frameworks/rails/activerecord5_test.rb
16
+ t.test_files = %w(test/frameworks/rails/activerecord_test.rb
17
17
  test/frameworks/rails/actioncontroller_test.rb
18
18
  test/frameworks/rails/actionview5_test.rb)
19
19
  when /rails42/
20
- t.test_files = %w(test/frameworks/rails/activerecord4_test.rb
20
+ t.test_files = %w(test/frameworks/rails/activerecord_test.rb
21
21
  test/frameworks/rails/actioncontroller_test.rb
22
22
  test/frameworks/rails/actionview4_test.rb)
23
23
  when /rails32/
24
- t.test_files = %w(test/frameworks/rails/activerecord3_test.rb
24
+ t.test_files = %w(test/frameworks/rails/activerecord_test.rb
25
25
  test/frameworks/rails/actioncontroller_test.rb
26
26
  test/frameworks/rails/actionview3_test.rb)
27
27
  when /libraries/
@@ -0,0 +1,3 @@
1
+ ---
2
+ BUNDLE_BUILD__LIBV8: "--with-system-v8"
3
+ BUNDLE_WITH: "development"
@@ -31,15 +31,15 @@ group :development do
31
31
  end
32
32
 
33
33
  gem 'rails', '3.2.22.5'
34
- gem 'pg'
35
- gem 'mysql2', '~> 0.3.10'
34
+ gem 'pg', '~> 0.21'
35
+ gem 'mysql2', '~> 0.3.21'
36
36
 
37
37
  # Gems used only for assets and not required
38
38
  # in production environments by default.
39
39
  group :assets do
40
40
  gem 'sass-rails', '~> 3.2.3'
41
41
  gem 'coffee-rails', '~> 3.2.1'
42
- gem 'therubyracer', :platforms => :ruby
42
+ #gem 'therubyracer', :platforms => :ruby
43
43
  gem 'uglifier', '>= 1.0.3'
44
44
  end
45
45
 
@@ -35,13 +35,13 @@ gem 'sqlite3'
35
35
  gem 'sass-rails', '~> 5.0'
36
36
  gem 'uglifier', '>= 1.3.0'
37
37
  gem 'coffee-rails', '~> 4.1.0'
38
- gem 'therubyracer', platforms: :ruby
38
+ #gem 'therubyracer', platforms: :ruby
39
39
 
40
40
  gem 'jquery-rails'
41
41
  gem 'turbolinks'
42
42
  gem 'jbuilder', '~> 2.0'
43
43
  gem 'sdoc', '~> 0.4.0', group: :doc
44
- gem "pg"
44
+ gem 'pg', '~> 0.21'
45
45
  gem "mysql2", '0.4.10'
46
46
 
47
47
  # Include the Instana Ruby gem's base set of gems
@@ -34,14 +34,14 @@ gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
34
34
  gem 'sass-rails', '~> 5.0'
35
35
  gem 'uglifier', '>= 1.3.0'
36
36
  gem 'coffee-rails', '~> 4.2'
37
- gem 'therubyracer', platforms: :ruby
37
+ #gem 'therubyracer', platforms: :ruby
38
38
 
39
39
  gem 'jquery-rails'
40
40
  gem 'turbolinks', '~> 5'
41
41
  gem 'jbuilder', '~> 2.5'
42
42
 
43
43
  gem 'pg'
44
- gem 'mysql2', '0.4.10'
44
+ gem 'mysql2', '0.5.2'
45
45
 
46
46
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
47
47
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -69,6 +69,8 @@ module Instana
69
69
  # appropriate children flags.
70
70
  @config[:metrics][:enabled] = value
71
71
  @config[:tracing][:enabled] = value
72
+
73
+ ::Instana.logger.warn "::Instana.config[:enabled] has been deprecated. Set INSTANA_DISABLE environment variable to any value instead."
72
74
  end
73
75
  end
74
76
  end
@@ -2,6 +2,7 @@ module Instana
2
2
  module Instrumentation
3
3
  module PostgreSQLAdapter
4
4
  IGNORED_PAYLOADS = %w(SCHEMA EXPLAIN CACHE).freeze
5
+ IGNORED_SQL = %w(BEGIN COMMIT)
5
6
  EXPLAINED_SQLS = /\A\s*(with|select|update|delete|insert)\b/i
6
7
 
7
8
  # This module supports instrumenting ActiveRecord with the postgresql adapter. Only
@@ -14,6 +15,8 @@ module Instana
14
15
  # ActiveRecord 3.1 and up
15
16
  Instana::Util.method_alias(klass, :exec_query)
16
17
  Instana::Util.method_alias(klass, :exec_delete)
18
+ Instana::Util.method_alias(klass, :execute)
19
+
17
20
 
18
21
  @@sanitize_regexp = Regexp.new('(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)', Regexp::IGNORECASE)
19
22
  end
@@ -42,7 +45,7 @@ module Instana
42
45
  # @return [Boolean]
43
46
  #
44
47
  def ignore_payload?(name, sql)
45
- IGNORED_PAYLOADS.include?(name) || sql !~ EXPLAINED_SQLS
48
+ IGNORED_PAYLOADS.include?(name) || IGNORED_SQL.include?(sql)
46
49
  end
47
50
 
48
51
  def exec_query_with_instana(sql, name = 'SQL', binds = [], *args)
@@ -66,6 +69,17 @@ module Instana
66
69
  exec_delete_without_instana(sql, name, binds)
67
70
  end
68
71
  end
72
+
73
+ def execute_with_instana(sql, name = nil)
74
+ if !::Instana.tracer.tracing? || ignore_payload?(name, sql)
75
+ return execute_without_instana(sql, name)
76
+ end
77
+
78
+ kv_payload = collect(sql)
79
+ ::Instana.tracer.trace(:activerecord, kv_payload) do
80
+ execute_without_instana(sql, name)
81
+ end
82
+ end
69
83
  end
70
84
  end
71
85
  end
@@ -12,13 +12,15 @@ module Instana
12
12
  ENV['TRAVIS_MYSQL_HOST'] ||= "127.0.0.1"
13
13
  ENV['TRAVIS_MYSQL_USER'] ||= "root"
14
14
 
15
- if ENV['DB_FLAVOR'] == 'postgresql'
16
- ENV['DATABASE_URL'] = "postgresql://#{ENV['TRAVIS_PSQL_USER']}:#{ENV['TRAVIS_PSQL_PASS']}@#{ENV['TRAVIS_PSQL_HOST']}:5432/travis_ci_test"
17
- elsif ENV['DB_FLAVOR'] == 'mysql'
18
- ENV['DATABASE_URL'] = "mysql://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
19
- else
20
- ENV['DB_FLAVOR'] ||= 'mysql2'
21
- ENV['DATABASE_URL'] = "mysql2://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
15
+ if !ENV.key?('DATABASE_URL')
16
+ if ENV['DB_FLAVOR'] == 'postgresql'
17
+ ENV['DATABASE_URL'] = "postgresql://#{ENV['TRAVIS_PSQL_USER']}:#{ENV['TRAVIS_PSQL_PASS']}@#{ENV['TRAVIS_PSQL_HOST']}:5432/travis_ci_test"
18
+ elsif ENV['DB_FLAVOR'] == 'mysql'
19
+ ENV['DATABASE_URL'] = "mysql://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
20
+ else
21
+ ENV['DB_FLAVOR'] ||= 'mysql2'
22
+ ENV['DATABASE_URL'] = "mysql2://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
23
+ end
22
24
  end
23
25
 
24
26
  Instana.logger.warn "Database connect string configured to: #{ENV['DATABASE_URL']}"
@@ -123,6 +123,8 @@ module Instana
123
123
 
124
124
  if HTTP_SPANS.include?(@data[:n])
125
125
  set_tags(:http => { :error => "#{e.class}: #{e.message}" })
126
+ elsif @data[:n] == :activerecord
127
+ @data[:data][:activerecord][:error] = e.message
126
128
  else
127
129
  log(:error, Time.now, { :message => e.message, :parameters => e.class.to_s })
128
130
  end
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.10.8"
2
+ VERSION = "1.10.9"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
@@ -12,12 +12,8 @@ class ActionViewTest < Minitest::Test
12
12
 
13
13
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
14
 
15
- traces = Instana.processor.queued_traces
16
- assert_equal 1, traces.length
17
- trace = traces.first
18
-
19
- assert_equal 3, trace.spans.length
20
- spans = trace.spans.to_a
15
+ spans = Instana.processor.queued_spans
16
+ assert_equal 3, spans.length
21
17
  first_span = spans[0]
22
18
  second_span = spans[1]
23
19
  third_span = spans[2]
@@ -32,12 +28,8 @@ class ActionViewTest < Minitest::Test
32
28
 
33
29
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
34
30
 
35
- traces = Instana.processor.queued_traces
36
- assert_equal 1, traces.length
37
- trace = traces.first
38
-
39
- assert_equal 3, trace.spans.length
40
- spans = trace.spans.to_a
31
+ spans = Instana.processor.queued_spans
32
+ assert_equal 3, spans.length
41
33
  first_span = spans[0]
42
34
  second_span = spans[1]
43
35
  third_span = spans[2]
@@ -53,12 +45,8 @@ class ActionViewTest < Minitest::Test
53
45
 
54
46
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
55
47
 
56
- traces = Instana.processor.queued_traces
57
- assert_equal 1, traces.length
58
- trace = traces.first
59
-
60
- assert_equal 3, trace.spans.length
61
- spans = trace.spans.to_a
48
+ spans = Instana.processor.queued_spans
49
+ assert_equal 3, spans.length
62
50
  first_span = spans[0]
63
51
  second_span = spans[1]
64
52
  third_span = spans[2]
@@ -74,12 +62,8 @@ class ActionViewTest < Minitest::Test
74
62
 
75
63
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
76
64
 
77
- traces = Instana.processor.queued_traces
78
- assert_equal 1, traces.length
79
- trace = traces.first
80
-
81
- assert_equal 3, trace.spans.length
82
- spans = trace.spans.to_a
65
+ spans = Instana.processor.queued_spans
66
+ assert_equal 3, spans.length
83
67
  first_span = spans[0]
84
68
  second_span = spans[1]
85
69
  third_span = spans[2]
@@ -95,12 +79,7 @@ class ActionViewTest < Minitest::Test
95
79
 
96
80
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
97
81
 
98
- traces = Instana.processor.queued_traces
99
- assert_equal 1, traces.length
100
- trace = traces.first
101
-
102
- assert_equal 3, trace.spans.length
103
- spans = trace.spans.to_a
82
+ assert_equal 3, spans.length
104
83
  first_span = spans[0]
105
84
  second_span = spans[1]
106
85
  third_span = spans[2]
@@ -116,12 +95,8 @@ class ActionViewTest < Minitest::Test
116
95
 
117
96
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
118
97
 
119
- traces = Instana.processor.queued_traces
120
- assert_equal 1, traces.length
121
- trace = traces.first
122
-
123
- assert_equal 3, trace.spans.length
124
- spans = trace.spans.to_a
98
+ spans = Instana.processor.queued_spans
99
+ assert_equal 3, spans.length
125
100
  first_span = spans[0]
126
101
  second_span = spans[1]
127
102
  third_span = spans[2]
@@ -137,12 +112,8 @@ class ActionViewTest < Minitest::Test
137
112
 
138
113
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
139
114
 
140
- traces = Instana.processor.queued_traces
141
- assert_equal 1, traces.length
142
- trace = traces.first
143
-
144
- assert_equal 3, trace.spans.length
145
- spans = trace.spans.to_a
115
+ spans = Instana.processor.queued_spans
116
+ assert_equal 3, spans.length
146
117
  first_span = spans[0]
147
118
  second_span = spans[1]
148
119
  third_span = spans[2]
@@ -158,12 +129,8 @@ class ActionViewTest < Minitest::Test
158
129
 
159
130
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
160
131
 
161
- traces = Instana.processor.queued_traces
162
- assert_equal 1, traces.length
163
- trace = traces.first
164
-
165
- assert_equal 3, trace.spans.length
166
- spans = trace.spans.to_a
132
+ spans = Instana.processor.queued_spans
133
+ assert_equal 3, spans.length
167
134
  first_span = spans[0]
168
135
  second_span = spans[1]
169
136
  third_span = spans[2]
@@ -179,12 +146,8 @@ class ActionViewTest < Minitest::Test
179
146
 
180
147
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
181
148
 
182
- traces = Instana.processor.queued_traces
183
- assert_equal 1, traces.length
184
- trace = traces.first
185
-
186
- assert_equal 4, trace.spans.length
187
- spans = trace.spans.to_a
149
+ spans = Instana.processor.queued_spans
150
+ assert_equal 4, spans.length
188
151
  first_span = spans[0]
189
152
  second_span = spans[1]
190
153
  third_span = spans[2]
@@ -203,12 +166,8 @@ class ActionViewTest < Minitest::Test
203
166
 
204
167
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
205
168
 
206
- traces = Instana.processor.queued_traces
207
- assert_equal 1, traces.length
208
- trace = traces.first
209
-
210
- assert_equal 4, trace.spans.length
211
- spans = trace.spans.to_a
169
+ spans = Instana.processor.queued_spans
170
+ assert_equal 4, spans.length
212
171
  first_span = spans[0]
213
172
  second_span = spans[1]
214
173
  third_span = spans[2]
@@ -231,12 +190,8 @@ class ActionViewTest < Minitest::Test
231
190
 
232
191
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
233
192
 
234
- traces = Instana.processor.queued_traces
235
- assert_equal 1, traces.length
236
- trace = traces.first
237
-
238
- assert_equal 5, trace.spans.length
239
- spans = trace.spans.to_a
193
+ spans = Instana.processor.queued_spans
194
+ assert_equal 5, spans.length
240
195
  first_span = spans[0]
241
196
  second_span = spans[1]
242
197
  third_span = spans[2]
@@ -12,19 +12,15 @@ class ActionViewTest < Minitest::Test
12
12
 
13
13
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
14
 
15
- traces = Instana.processor.queued_traces
16
- assert_equal 1, traces.length
17
- trace = traces.first
18
-
19
- assert_equal 3, trace.spans.length
20
- spans = trace.spans.to_a
21
- first_span = spans[0]
22
- second_span = spans[1]
23
- third_span = spans[2]
24
-
25
- assert_equal :rack, first_span.name
26
- assert_equal :actioncontroller, second_span.name
27
- assert_equal :actionview, third_span.name
15
+ spans = Instana.processor.queued_spans
16
+ assert_equal 3, spans.length
17
+ rack_span = find_first_span_by_name(spans, :rack)
18
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
19
+ av_span = find_first_span_by_name(spans, :actionview)
20
+
21
+ assert_equal :rack, rack_span[:n]
22
+ assert_equal :actioncontroller, ac_span[:n]
23
+ assert_equal :actionview, av_span[:n]
28
24
  end
29
25
 
30
26
  def test_render_nothing
@@ -32,20 +28,16 @@ class ActionViewTest < Minitest::Test
32
28
 
33
29
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_nothing'))
34
30
 
35
- traces = Instana.processor.queued_traces
36
- assert_equal 1, traces.length
37
- trace = traces.first
31
+ spans = Instana.processor.queued_spans
32
+ assert_equal 3, spans.length
33
+ rack_span = find_first_span_by_name(spans, :rack)
34
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
35
+ av_span = find_first_span_by_name(spans, :actionview)
38
36
 
39
- assert_equal 3, trace.spans.length
40
- spans = trace.spans.to_a
41
- first_span = spans[0]
42
- second_span = spans[1]
43
- third_span = spans[2]
44
-
45
- assert_equal :rack, first_span.name
46
- assert_equal :actioncontroller, second_span.name
47
- assert_equal "Nothing", third_span[:data][:actionview][:name]
48
- assert_equal :actionview, third_span.name
37
+ assert_equal :rack, rack_span[:n]
38
+ assert_equal :actioncontroller, ac_span[:n]
39
+ assert_equal "Nothing", av_span[:data][:actionview][:name]
40
+ assert_equal :actionview, av_span[:n]
49
41
  end
50
42
 
51
43
  def test_render_file
@@ -53,20 +45,16 @@ class ActionViewTest < Minitest::Test
53
45
 
54
46
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_file'))
55
47
 
56
- traces = Instana.processor.queued_traces
57
- assert_equal 1, traces.length
58
- trace = traces.first
59
-
60
- assert_equal 3, trace.spans.length
61
- spans = trace.spans.to_a
62
- first_span = spans[0]
63
- second_span = spans[1]
64
- third_span = spans[2]
48
+ spans = Instana.processor.queued_spans
49
+ assert_equal 3, spans.length
50
+ rack_span = find_first_span_by_name(spans, :rack)
51
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
52
+ av_span = find_first_span_by_name(spans, :actionview)
65
53
 
66
- assert_equal :rack, first_span.name
67
- assert_equal :actioncontroller, second_span.name
68
- assert_equal "/etc/issue", third_span[:data][:actionview][:name]
69
- assert_equal :actionview, third_span.name
54
+ assert_equal :rack, rack_span[:n]
55
+ assert_equal :actioncontroller, ac_span[:n]
56
+ assert_equal "/etc/issue", av_span[:data][:actionview][:name]
57
+ assert_equal :actionview, av_span[:n]
70
58
  end
71
59
 
72
60
  def test_render_json
@@ -74,20 +62,16 @@ class ActionViewTest < Minitest::Test
74
62
 
75
63
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_json'))
76
64
 
77
- traces = Instana.processor.queued_traces
78
- assert_equal 1, traces.length
79
- trace = traces.first
65
+ spans = Instana.processor.queued_spans
66
+ assert_equal 3, spans.length
67
+ rack_span = find_first_span_by_name(spans, :rack)
68
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
69
+ av_span = find_first_span_by_name(spans, :actionview)
80
70
 
81
- assert_equal 3, trace.spans.length
82
- spans = trace.spans.to_a
83
- first_span = spans[0]
84
- second_span = spans[1]
85
- third_span = spans[2]
86
-
87
- assert_equal :rack, first_span.name
88
- assert_equal :actioncontroller, second_span.name
89
- assert_equal "JSON", third_span[:data][:actionview][:name]
90
- assert_equal :actionview, third_span.name
71
+ assert_equal :rack, rack_span[:n]
72
+ assert_equal :actioncontroller, ac_span[:n]
73
+ assert_equal "JSON", av_span[:data][:actionview][:name]
74
+ assert_equal :actionview, av_span[:n]
91
75
  end
92
76
 
93
77
  def test_render_xml
@@ -95,20 +79,16 @@ class ActionViewTest < Minitest::Test
95
79
 
96
80
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_xml'))
97
81
 
98
- traces = Instana.processor.queued_traces
99
- assert_equal 1, traces.length
100
- trace = traces.first
101
-
102
- assert_equal 3, trace.spans.length
103
- spans = trace.spans.to_a
104
- first_span = spans[0]
105
- second_span = spans[1]
106
- third_span = spans[2]
82
+ spans = Instana.processor.queued_spans
83
+ assert_equal 3, spans.length
84
+ rack_span = find_first_span_by_name(spans, :rack)
85
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
86
+ av_span = find_first_span_by_name(spans, :actionview)
107
87
 
108
- assert_equal :rack, first_span.name
109
- assert_equal :actioncontroller, second_span.name
110
- assert_equal "XML", third_span[:data][:actionview][:name]
111
- assert_equal :actionview, third_span.name
88
+ assert_equal :rack, rack_span[:n]
89
+ assert_equal :actioncontroller, ac_span[:n]
90
+ assert_equal "XML", av_span[:data][:actionview][:name]
91
+ assert_equal :actionview, av_span[:n]
112
92
  end
113
93
 
114
94
  def test_render_body
@@ -116,20 +96,16 @@ class ActionViewTest < Minitest::Test
116
96
 
117
97
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_rawbody'))
118
98
 
119
- traces = Instana.processor.queued_traces
120
- assert_equal 1, traces.length
121
- trace = traces.first
99
+ spans = Instana.processor.queued_spans
100
+ assert_equal 3, spans.length
101
+ rack_span = find_first_span_by_name(spans, :rack)
102
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
103
+ av_span = find_first_span_by_name(spans, :actionview)
122
104
 
123
- assert_equal 3, trace.spans.length
124
- spans = trace.spans.to_a
125
- first_span = spans[0]
126
- second_span = spans[1]
127
- third_span = spans[2]
128
-
129
- assert_equal :rack, first_span.name
130
- assert_equal :actioncontroller, second_span.name
131
- assert_equal "Raw", third_span[:data][:actionview][:name]
132
- assert_equal :actionview, third_span.name
105
+ assert_equal :rack, rack_span[:n]
106
+ assert_equal :actioncontroller, ac_span[:n]
107
+ assert_equal "Raw", av_span[:data][:actionview][:name]
108
+ assert_equal :actionview, av_span[:n]
133
109
  end
134
110
 
135
111
  def test_render_js
@@ -137,20 +113,16 @@ class ActionViewTest < Minitest::Test
137
113
 
138
114
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_js'))
139
115
 
140
- traces = Instana.processor.queued_traces
141
- assert_equal 1, traces.length
142
- trace = traces.first
143
-
144
- assert_equal 3, trace.spans.length
145
- spans = trace.spans.to_a
146
- first_span = spans[0]
147
- second_span = spans[1]
148
- third_span = spans[2]
116
+ spans = Instana.processor.queued_spans
117
+ assert_equal 3, spans.length
118
+ rack_span = find_first_span_by_name(spans, :rack)
119
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
120
+ av_span = find_first_span_by_name(spans, :actionview)
149
121
 
150
- assert_equal :rack, first_span.name
151
- assert_equal :actioncontroller, second_span.name
152
- assert_equal "Javascript", third_span[:data][:actionview][:name]
153
- assert_equal :actionview, third_span.name
122
+ assert_equal :rack, rack_span[:n]
123
+ assert_equal :actioncontroller, ac_span[:n]
124
+ assert_equal "Javascript", av_span[:data][:actionview][:name]
125
+ assert_equal :actionview, av_span[:n]
154
126
  end
155
127
 
156
128
  def test_render_alternate_layout
@@ -158,20 +130,16 @@ class ActionViewTest < Minitest::Test
158
130
 
159
131
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_alternate_layout'))
160
132
 
161
- traces = Instana.processor.queued_traces
162
- assert_equal 1, traces.length
163
- trace = traces.first
164
-
165
- assert_equal 3, trace.spans.length
166
- spans = trace.spans.to_a
167
- first_span = spans[0]
168
- second_span = spans[1]
169
- third_span = spans[2]
133
+ spans = Instana.processor.queued_spans
134
+ assert_equal 3, spans.length
135
+ rack_span = find_first_span_by_name(spans, :rack)
136
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
137
+ av_span = find_first_span_by_name(spans, :actionview)
170
138
 
171
- assert_equal :rack, first_span.name
172
- assert_equal :actioncontroller, second_span.name
173
- assert_equal "layouts/mobile", third_span[:data][:actionview][:name]
174
- assert_equal :actionview, third_span.name
139
+ assert_equal :rack, rack_span[:n]
140
+ assert_equal :actioncontroller, ac_span[:n]
141
+ assert_equal "layouts/mobile", av_span[:data][:actionview][:name]
142
+ assert_equal :actionview, av_span[:n]
175
143
  end
176
144
 
177
145
  def test_render_partial
@@ -179,23 +147,17 @@ class ActionViewTest < Minitest::Test
179
147
 
180
148
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
181
149
 
182
- traces = Instana.processor.queued_traces
183
- assert_equal 1, traces.length
184
- trace = traces.first
185
-
186
- assert_equal 4, trace.spans.length
187
- spans = trace.spans.to_a
188
- first_span = spans[0]
189
- second_span = spans[1]
190
- third_span = spans[2]
191
- fourth_span = spans[3]
192
-
193
- assert_equal :rack, first_span.name
194
- assert_equal :actioncontroller, second_span.name
195
- assert_equal :actionview, third_span.name
196
- assert_equal :render, fourth_span.name
197
- assert_equal :partial, fourth_span[:data][:render][:type]
198
- assert_equal 'message', fourth_span[:data][:render][:name]
150
+ spans = Instana.processor.queued_spans
151
+ assert_equal 4, spans.length
152
+ rack_span = find_first_span_by_name(spans, :rack)
153
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
154
+ av_span = find_first_span_by_name(spans, :actionview)
155
+ render_span = find_first_span_by_name(spans, :render)
156
+
157
+ assert_equal :rack, rack_span[:n]
158
+ assert_equal :actioncontroller, ac_span[:n]
159
+ assert_equal :partial, render_span[:data][:render][:type]
160
+ assert_equal 'message', render_span[:data][:render][:name]
199
161
  end
200
162
 
201
163
  def test_render_partial_that_errors
@@ -203,27 +165,23 @@ class ActionViewTest < Minitest::Test
203
165
 
204
166
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
205
167
 
206
- traces = Instana.processor.queued_traces
207
- assert_equal 1, traces.length
208
- trace = traces.first
209
-
210
- assert_equal 4, trace.spans.length
211
- spans = trace.spans.to_a
212
- first_span = spans[0]
213
- second_span = spans[1]
214
- third_span = spans[2]
215
- fourth_span = spans[3]
216
-
217
- assert_equal :rack, first_span.name
218
- assert_equal :actioncontroller, second_span.name
219
- assert_equal :actionview, third_span.name
220
- assert_equal :render, fourth_span.name
221
- assert_equal :partial, fourth_span[:data][:render][:type]
222
- assert_equal 'syntax_error', fourth_span[:data][:render][:name]
223
- assert fourth_span[:data][:log].key?(:message)
224
- assert_equal "SyntaxError", fourth_span[:data][:log][:parameters]
225
- assert fourth_span[:error]
226
- assert fourth_span[:stack]
168
+ spans = Instana.processor.queued_spans
169
+ assert_equal 4, spans.length
170
+ rack_span = find_first_span_by_name(spans, :rack)
171
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
172
+ av_span = find_first_span_by_name(spans, :actionview)
173
+ render_span = find_first_span_by_name(spans, :render)
174
+
175
+ assert_equal :rack, rack_span[:n]
176
+ assert_equal :actioncontroller, ac_span[:n]
177
+ assert_equal :actionview, av_span[:n]
178
+ assert_equal :render, render_span[:n]
179
+ assert_equal :partial, render_span[:data][:render][:type]
180
+ assert_equal 'syntax_error', render_span[:data][:render][:name]
181
+ assert render_span[:data][:log].key?(:message)
182
+ assert_equal "SyntaxError", render_span[:data][:log][:parameters]
183
+ assert render_span[:error]
184
+ assert render_span[:stack]
227
185
  end
228
186
 
229
187
  def test_render_collection
@@ -231,24 +189,20 @@ class ActionViewTest < Minitest::Test
231
189
 
232
190
  Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
233
191
 
234
- traces = Instana.processor.queued_traces
235
- assert_equal 1, traces.length
236
- trace = traces.first
237
-
238
- assert_equal 5, trace.spans.length
239
- spans = trace.spans.to_a
240
- first_span = spans[0]
241
- second_span = spans[1]
242
- third_span = spans[2]
243
- fourth_span = spans[3]
244
- fifth_span = spans[4]
245
-
246
- assert_equal :rack, first_span.name
247
- assert_equal :actioncontroller, second_span.name
248
- assert_equal :actionview, third_span.name
249
- assert_equal :activerecord, fourth_span.name
250
- assert_equal :render, fifth_span.name
251
- assert_equal :collection, fifth_span[:data][:render][:type]
252
- assert_equal 'blocks/block', fifth_span[:data][:render][:name]
192
+ spans = Instana.processor.queued_spans
193
+ assert_equal 5, spans.length
194
+ rack_span = find_first_span_by_name(spans, :rack)
195
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
196
+ av_span = find_first_span_by_name(spans, :actionview)
197
+ ar_span = find_first_span_by_name(spans, :activerecord)
198
+ render_span = find_first_span_by_name(spans, :render)
199
+
200
+ assert_equal :rack, rack_span[:n]
201
+ assert_equal :actioncontroller, ac_span[:n]
202
+ assert_equal :actionview, av_span[:n]
203
+ assert_equal :activerecord, ar_span[:n]
204
+ assert_equal :render, render_span[:n]
205
+ assert_equal :collection, render_span[:data][:render][:type]
206
+ assert_equal 'blocks/block', render_span[:data][:render][:name]
253
207
  end
254
208
  end