instana 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b29ece207c8410bea84eb595c1f70e0f019502f
4
- data.tar.gz: 527d974dadaa17372a87f7fafabd28de2a4601c2
3
+ metadata.gz: d4f4776893611a534108c425fee351857893c440
4
+ data.tar.gz: c432c9c4ac294429d3a2e1c7db6f9d995c7f8e27
5
5
  SHA512:
6
- metadata.gz: cc6a8d6780ac0d0ac0cea4d56e1e794e99a1a740475bd7dd6f1537c3595409a0fea824663b693a71f3192885693a05dec5d1ac507c63c6c54841ed8f40e4e541
7
- data.tar.gz: 6df29e6b77dc0dfd303965acf1d6eec9282f3fef83c91360acfa78a68247609b00b3a34b9b788b238a8c5fee965e34f01f56dafce1a2c37b40ec56382a756d42
6
+ metadata.gz: 469f5a906f2936196c3af073c7d07b13191414690b3646ac1a216b10deaee0f609d8767b22a4ead6eb32a2d4ef828943b73000de30dca305d7150ad08e9f2e17
7
+ data.tar.gz: f9e47e7a26878761d9353a25ae6de9a82b1d6ed19cf143a7e4feb684e47e0ec2139deaee5a7f3e9a780685021539afb27861534c6569f06170062bdb328b7b24
data/Rakefile CHANGED
@@ -12,11 +12,17 @@ Rake::TestTask.new(:test) do |t|
12
12
 
13
13
  case File.basename(ENV['BUNDLE_GEMFILE']).split('.').first
14
14
  when /rails50/
15
- t.test_files = FileList['test/frameworks/rails/activerecord5_test.rb'] + FileList['test/frameworks/rails/actioncontroller_test.rb']
15
+ t.test_files = [ 'test/frameworks/rails/activerecord5_test.rb',
16
+ 'test/frameworks/rails/actioncontroller_test.rb',
17
+ 'test/frameworks/rails/actionview5_test.rb' ]
16
18
  when /rails42/
17
- t.test_files = FileList['test/frameworks/rails/activerecord4_test.rb'] + FileList['test/frameworks/rails/actioncontroller_test.rb']
19
+ t.test_files = [ 'test/frameworks/rails/activerecord4_test.rb',
20
+ 'test/frameworks/rails/actioncontroller_test.rb',
21
+ 'test/frameworks/rails/actionview4_test.rb' ]
18
22
  when /rails32/
19
- t.test_files = FileList['test/frameworks/rails/activerecord3_test.rb'] + FileList['test/frameworks/rails/actioncontroller_test.rb']
23
+ t.test_files = [ 'test/frameworks/rails/activerecord3_test.rb',
24
+ 'test/frameworks/rails/actioncontroller_test.rb',
25
+ 'test/frameworks/rails/actionview3_test.rb' ]
20
26
  when /libraries/
21
27
  t.test_files = FileList['test/instrumentation/*_test.rb']
22
28
  else
@@ -49,6 +49,19 @@ module Instana
49
49
  ensure
50
50
  ::Instana.tracer.log_exit(:actioncontroller)
51
51
  end
52
+
53
+ # The Instana wrapper method for ActionController::Base.render
54
+ # for versions 5+.
55
+ #
56
+ def render(*args, &blk)
57
+ ::Instana.tracer.log_entry(:actionview)
58
+ super(*args, &blk)
59
+ rescue Exception => e
60
+ ::Instana.tracer.log_error(e) unless has_rails_handler?
61
+ raise
62
+ ensure
63
+ ::Instana.tracer.log_exit(:actionview)
64
+ end
52
65
  end
53
66
 
54
67
  # Used in ActionPack versions 4 and earlier, this module provides
@@ -14,7 +14,7 @@ module Instana
14
14
  ::Instana.tracer.log_entry(:render, kv_payload)
15
15
  render_partial_without_instana
16
16
  rescue Exception => e
17
- ::Instana.tracer.log_error(e) unless has_rails_handler?
17
+ ::Instana.tracer.log_error(e)
18
18
  raise
19
19
  ensure
20
20
  ::Instana.tracer.log_exit(:render)
@@ -28,7 +28,7 @@ module Instana
28
28
  ::Instana.tracer.log_entry(:render, kv_payload)
29
29
  render_collection_without_instana
30
30
  rescue Exception => e
31
- ::Instana.tracer.log_error(e) unless has_rails_handler?
31
+ ::Instana.tracer.log_error(e)
32
32
  raise
33
33
  ensure
34
34
  ::Instana.tracer.log_exit(:render)
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
@@ -16,11 +16,7 @@ class ActionControllerTest < Minitest::Test
16
16
  assert_equal 1, traces.count
17
17
  trace = traces.first
18
18
 
19
- if ::Rails::VERSION::MAJOR > 4
20
- assert_equal 2, trace.spans.count
21
- else
22
- assert_equal 3, trace.spans.count
23
- end
19
+ assert_equal 3, trace.spans.count
24
20
  spans = trace.spans.to_a
25
21
  first_span = spans[0]
26
22
  second_span = spans[1]
@@ -69,7 +65,7 @@ class ActionControllerTest < Minitest::Test
69
65
  assert_equal 1, traces.count
70
66
  trace = traces.first
71
67
 
72
- assert_equal 2, trace.spans.count
68
+ assert_equal 3, trace.spans.count
73
69
  spans = trace.spans.to_a
74
70
  first_span = spans[0]
75
71
  second_span = spans[1]
@@ -51,6 +51,34 @@ class ActionViewTest < Minitest::Test
51
51
  assert_equal 'message', fourth_span[:data][:render][:name]
52
52
  end
53
53
 
54
+ def test_render_partial_that_errors
55
+ clear_all!
56
+
57
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
58
+
59
+ traces = Instana.processor.queued_traces
60
+ assert_equal 1, traces.count
61
+ trace = traces.first
62
+
63
+ assert_equal 4, trace.spans.count
64
+ spans = trace.spans.to_a
65
+ first_span = spans[0]
66
+ second_span = spans[1]
67
+ third_span = spans[2]
68
+ fourth_span = spans[3]
69
+
70
+ assert_equal :rack, first_span.name
71
+ assert_equal :actioncontroller, second_span.name
72
+ assert_equal :actionview, third_span.name
73
+ assert_equal :render, fourth_span.name
74
+ assert_equal :partial, fourth_span[:data][:render][:type]
75
+ assert_equal 'syntax_error', fourth_span[:data][:render][:name]
76
+ assert fourth_span[:data][:log].key?(:message)
77
+ assert_equal "ActionView::Template::Error", fourth_span[:data][:log][:parameters]
78
+ assert fourth_span[:error]
79
+ assert fourth_span[:stack]
80
+ end
81
+
54
82
  def test_render_collection
55
83
  clear_all!
56
84
 
@@ -0,0 +1,108 @@
1
+ require 'test_helper'
2
+
3
+ class ActionViewTest < Minitest::Test
4
+ def test_config_defaults
5
+ assert ::Instana.config[:action_view].is_a?(Hash)
6
+ assert ::Instana.config[:action_view].key?(:enabled)
7
+ assert_equal true, ::Instana.config[:action_view][:enabled]
8
+ end
9
+
10
+ def test_render_view
11
+ clear_all!
12
+
13
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
+
15
+ traces = Instana.processor.queued_traces
16
+ assert_equal 1, traces.count
17
+ trace = traces.first
18
+
19
+ assert_equal 3, trace.spans.count
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
28
+ end
29
+
30
+ def test_render_partial
31
+ clear_all!
32
+
33
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
34
+
35
+ traces = Instana.processor.queued_traces
36
+ assert_equal 1, traces.count
37
+ trace = traces.first
38
+
39
+ assert_equal 4, trace.spans.count
40
+ spans = trace.spans.to_a
41
+ first_span = spans[0]
42
+ second_span = spans[1]
43
+ third_span = spans[2]
44
+ fourth_span = spans[3]
45
+
46
+ assert_equal :rack, first_span.name
47
+ assert_equal :actioncontroller, second_span.name
48
+ assert_equal :actionview, third_span.name
49
+ assert_equal :render, fourth_span.name
50
+ assert_equal :partial, fourth_span[:data][:render][:type]
51
+ assert_equal 'message', fourth_span[:data][:render][:name]
52
+ end
53
+
54
+ def test_render_partial_that_errors
55
+ clear_all!
56
+
57
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
58
+
59
+ traces = Instana.processor.queued_traces
60
+ assert_equal 1, traces.count
61
+ trace = traces.first
62
+
63
+ assert_equal 4, trace.spans.count
64
+ spans = trace.spans.to_a
65
+ first_span = spans[0]
66
+ second_span = spans[1]
67
+ third_span = spans[2]
68
+ fourth_span = spans[3]
69
+
70
+ assert_equal :rack, first_span.name
71
+ assert_equal :actioncontroller, second_span.name
72
+ assert_equal :actionview, third_span.name
73
+ assert_equal :render, fourth_span.name
74
+ assert_equal :partial, fourth_span[:data][:render][:type]
75
+ assert_equal 'syntax_error', fourth_span[:data][:render][:name]
76
+ assert fourth_span[:data][:log].key?(:message)
77
+ assert_equal "SyntaxError", fourth_span[:data][:log][:parameters]
78
+ assert fourth_span[:error]
79
+ assert fourth_span[:stack]
80
+ end
81
+
82
+ def test_render_collection
83
+ clear_all!
84
+
85
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
86
+
87
+ traces = Instana.processor.queued_traces
88
+ assert_equal 1, traces.count
89
+ trace = traces.first
90
+
91
+ assert_equal 5, trace.spans.count
92
+ spans = trace.spans.to_a
93
+ first_span = spans[0]
94
+ second_span = spans[1]
95
+ third_span = spans[2]
96
+ fourth_span = spans[3]
97
+ fifth_span = spans[4]
98
+
99
+ assert_equal :rack, first_span.name
100
+ assert_equal :actioncontroller, second_span.name
101
+ assert_equal :actionview, third_span.name
102
+ assert_equal :activerecord, fourth_span.name
103
+ assert_equal :render, fifth_span.name
104
+ assert_equal :collection, fifth_span[:data][:render][:type]
105
+ assert_equal 'blocks/block', fifth_span[:data][:render][:name]
106
+ end
107
+ end
108
+
@@ -0,0 +1,116 @@
1
+ require 'test_helper'
2
+
3
+ class ActionViewTest < Minitest::Test
4
+ def test_config_defaults
5
+ assert ::Instana.config[:action_view].is_a?(Hash)
6
+ assert ::Instana.config[:action_view].key?(:enabled)
7
+ assert_equal true, ::Instana.config[:action_view][:enabled]
8
+ end
9
+
10
+ def test_render_view
11
+ clear_all!
12
+
13
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_view'))
14
+
15
+ traces = Instana.processor.queued_traces
16
+ assert_equal 1, traces.count
17
+ trace = traces.first
18
+
19
+ assert_equal 3, trace.spans.count
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
28
+ end
29
+
30
+ def test_render_partial
31
+ clear_all!
32
+
33
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial'))
34
+
35
+ traces = Instana.processor.queued_traces
36
+ assert_equal 1, traces.count
37
+ trace = traces.first
38
+
39
+ assert_equal 4, trace.spans.count
40
+ spans = trace.spans.to_a
41
+ first_span = spans[0]
42
+ second_span = spans[1]
43
+ third_span = spans[2]
44
+ fourth_span = spans[3]
45
+
46
+ assert_equal :rack, first_span.name
47
+ assert_equal :actioncontroller, second_span.name
48
+ assert_equal :actionview, third_span.name
49
+ assert_equal :render, fourth_span.name
50
+ assert_equal :partial, fourth_span[:data][:render][:type]
51
+ assert_equal 'message', fourth_span[:data][:render][:name]
52
+ end
53
+
54
+ def test_render_partial_that_errors
55
+ clear_all!
56
+
57
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_partial_that_errors'))
58
+
59
+ traces = Instana.processor.queued_traces
60
+ assert_equal 1, traces.count
61
+ trace = traces.first
62
+
63
+ assert_equal 4, trace.spans.count
64
+ spans = trace.spans.to_a
65
+ first_span = spans[0]
66
+ second_span = spans[1]
67
+ third_span = spans[2]
68
+ fourth_span = spans[3]
69
+
70
+ assert_equal :rack, first_span.name
71
+ assert_equal :actioncontroller, second_span.name
72
+ assert_equal :actionview, third_span.name
73
+ assert_equal :render, fourth_span.name
74
+ assert_equal :partial, fourth_span[:data][:render][:type]
75
+ assert_equal 'syntax_error', fourth_span[:data][:render][:name]
76
+ assert fourth_span[:data][:log].key?(:message)
77
+ assert_equal "SyntaxError", fourth_span[:data][:log][:parameters]
78
+ assert fourth_span[:error]
79
+ assert fourth_span[:stack]
80
+ end
81
+
82
+ def test_render_collection
83
+ clear_all!
84
+
85
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/render_collection'))
86
+
87
+ traces = Instana.processor.queued_traces
88
+ assert_equal 1, traces.count
89
+ trace = traces.first
90
+
91
+ assert_equal 5, trace.spans.count
92
+ spans = trace.spans.to_a
93
+ first_span = spans[0]
94
+ second_span = spans[1]
95
+ third_span = spans[2]
96
+ fourth_span = spans[3]
97
+ fifth_span = spans[4]
98
+
99
+ assert_equal :rack, first_span.name
100
+ assert_equal :actioncontroller, second_span.name
101
+
102
+
103
+ if Rails::VERSION::STRING < '4.0'
104
+ assert_equal :activerecord, third_span.name
105
+ assert_equal :actionview, fourth_span.name
106
+ else
107
+ assert_equal :actionview, third_span.name
108
+ assert_equal :activerecord, fourth_span.name
109
+ end
110
+
111
+ assert_equal :render, fifth_span.name
112
+ assert_equal :collection, fifth_span[:data][:render][:type]
113
+ assert_equal 'blocks/block', fifth_span[:data][:render][:name]
114
+ end
115
+ end
116
+
@@ -19,7 +19,7 @@ class ActiveRecordTest < Minitest::Test
19
19
  assert_equal 1, traces.count
20
20
  trace = traces.first
21
21
 
22
- assert_equal 5, trace.spans.count
22
+ assert_equal 6, trace.spans.count
23
23
  spans = trace.spans.to_a
24
24
  first_span = spans[0]
25
25
  second_span = spans[2]
@@ -59,7 +59,7 @@ class ActiveRecordTest < Minitest::Test
59
59
  assert_equal 1, traces.count
60
60
  trace = traces.first
61
61
 
62
- assert_equal 5, trace.spans.count
62
+ assert_equal 6, trace.spans.count
63
63
  spans = trace.spans.to_a
64
64
  first_span = spans[0]
65
65
  second_span = spans[2]
@@ -27,6 +27,7 @@ class RailsTestApp < Rails::Application
27
27
  get "/test/error" => "test#error"
28
28
  get "/test/render_view" => "test#render_view"
29
29
  get "/test/render_partial" => "test#render_partial"
30
+ get "/test/render_partial_that_errors" => "test#render_partial_that_errors"
30
31
  get "/test/render_collection" => "test#render_collection"
31
32
 
32
33
  get "/api/world" => "socket#world"
@@ -82,6 +83,10 @@ class TestController < ActionController::Base
82
83
  @message = "Hello Instana!"
83
84
  end
84
85
 
86
+ def render_partial_that_errors
87
+ @message = "Hello Instana!"
88
+ end
89
+
85
90
  def render_collection
86
91
  @blocks = Block.all
87
92
  end
@@ -109,6 +114,10 @@ end
109
114
 
110
115
  RailsTestApp.initialize!
111
116
 
117
+ # Initialize some blocks so we have stuff to test against.
118
+ Block.new(:name => :corner, :color => :blue).save
119
+ Block.new(:name => :floor, :color => :green).save
120
+
112
121
  Thread.new do
113
122
  Rack::Handler::Puma.run(RailsTestApp.to_app, {:Host => '127.0.0.1', :Port => 3205})
114
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -227,7 +227,9 @@ files:
227
227
  - test/frameworks/cuba_test.rb
228
228
  - test/frameworks/rack_test.rb
229
229
  - test/frameworks/rails/actioncontroller_test.rb
230
- - test/frameworks/rails/actionview_test.rb
230
+ - test/frameworks/rails/actionview3_test.rb
231
+ - test/frameworks/rails/actionview4_test.rb
232
+ - test/frameworks/rails/actionview5_test.rb
231
233
  - test/frameworks/rails/activerecord3_test.rb
232
234
  - test/frameworks/rails/activerecord4_test.rb
233
235
  - test/frameworks/rails/activerecord5_test.rb
@@ -280,7 +282,9 @@ test_files:
280
282
  - test/frameworks/cuba_test.rb
281
283
  - test/frameworks/rack_test.rb
282
284
  - test/frameworks/rails/actioncontroller_test.rb
283
- - test/frameworks/rails/actionview_test.rb
285
+ - test/frameworks/rails/actionview3_test.rb
286
+ - test/frameworks/rails/actionview4_test.rb
287
+ - test/frameworks/rails/actionview5_test.rb
284
288
  - test/frameworks/rails/activerecord3_test.rb
285
289
  - test/frameworks/rails/activerecord4_test.rb
286
290
  - test/frameworks/rails/activerecord5_test.rb