instana 1.10.9 → 1.10.10

This diff has not been reviewed by any users.
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
  SHA256:
3
- metadata.gz: 799531344ea9b755a3a2ac8358f4f865f048c87f1369ae44b71d3ac0ebbf576c
4
- data.tar.gz: e971ec9577aec2396db65c095ce17b6347b4cc3f602d72e975d7602782afd265
3
+ metadata.gz: 54dbfa2e6e3fee8fd8337508ce7d7d081a1194f8af73bde7c2cf5fb35aac326a
4
+ data.tar.gz: c075709c97ef6659d4ab6f5533cad16f77fdcaaff79ebd6fabeddf53f49ef72f
5
5
  SHA512:
6
- metadata.gz: 1443d5dff0ce3364b164de6062ee75a50882bacd433fbad034bb2353bbac462deaab77610c16c3235cd5114b2f8c10aa7c47603f35821afe39790011801960b0
7
- data.tar.gz: e429a228dbd9706d45e6fdcda03349c11843ad5bcb80440d4e013f994c02d9e6b42f434c7dcbb84428b6fcabb5cc16c7dc4768ee0eecad65db4be81ae103e651
6
+ metadata.gz: f290172a3f51b156f1eece7f23a53021766c7213b795191c5c33103c57006ce96e7155fee264dfcf102ebcc2836f55f52ef5e1faf2074d1b23e1953db932803d
7
+ data.tar.gz: a664f54a125015cb539e690add70372cdfea5d8519f556a36a88b7680a5b7cf65fbaece21b56a45a756d4d4a6432fd8327413b4d06a7850c23fc9a4ff5b1a876
@@ -51,9 +51,13 @@ module Instana
51
51
  status, headers, response = @app.call(env)
52
52
 
53
53
  if ::Instana.tracer.tracing?
54
- kvs[:http][:status] = status
54
+ # In case some previous middleware returned a string status, make sure that we're dealing with
55
+ # an integer. In Ruby nil.to_i, "asdfasdf".to_i will always return 0 from Ruby versions 1.8.7 and newer.
56
+ # So if an 0 status is reported here, it indicates some other issue (e.g. no status from previous middleware)
57
+ # See Rack Spec: https://www.rubydoc.info/github/rack/rack/file/SPEC#label-The+Status
58
+ kvs[:http][:status] = status.to_i
55
59
 
56
- if !status.is_a?(Integer) || status.between?(500, 511)
60
+ if status.to_i.between?(500, 511)
57
61
  # Because of the 5xx response, we flag this span as errored but
58
62
  # without a backtrace (no exception)
59
63
  ::Instana.tracer.log_error(nil)
@@ -1,4 +1,4 @@
1
1
  module Instana
2
- VERSION = "1.10.9"
2
+ VERSION = "1.10.10"
3
3
  VERSION_FULL = "instana-#{VERSION}"
4
4
  end
@@ -78,6 +78,49 @@ class ActionControllerTest < Minitest::Test
78
78
  assert_equal "Exception", ac_span[:data][:log][:parameters]
79
79
  end
80
80
 
81
+ def test_api_controller_404
82
+ # Run only when ActionController::API is used/defined
83
+ skip unless defined?(::ActionController::API)
84
+
85
+ clear_all!
86
+
87
+ Net::HTTP.get(URI.parse('http://localhost:3205/api/thispathdoesnotexist'))
88
+
89
+ spans = ::Instana.processor.queued_spans
90
+ assert_equal 1, spans.length
91
+
92
+ rack_span = find_first_span_by_name(spans, :rack)
93
+
94
+ assert_equal false, rack_span.key?(:error)
95
+ assert_equal "/api/thispathdoesnotexist", rack_span[:data][:http][:url]
96
+ assert_equal 404, rack_span[:data][:http][:status]
97
+ assert_equal "GET", rack_span[:data][:http][:method]
98
+ end
99
+
100
+ def test_api_controller_raise_routing_error
101
+ # Run only when ActionController::API is used/defined
102
+ skip unless defined?(::ActionController::API)
103
+
104
+ clear_all!
105
+
106
+ Net::HTTP.get(URI.parse('http://localhost:3205/api/raise_route_error'))
107
+
108
+ spans = ::Instana.processor.queued_spans
109
+ assert_equal 2, spans.length
110
+
111
+ rack_span = find_first_span_by_name(spans, :rack)
112
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
113
+
114
+ assert_equal false, rack_span.key?(:error)
115
+ assert_equal "/api/raise_route_error", rack_span[:data][:http][:url]
116
+ assert_equal 404, rack_span[:data][:http][:status]
117
+ assert_equal "GET", rack_span[:data][:http][:method]
118
+
119
+ assert_equal true, ac_span[:error]
120
+ assert ac_span.key?(:stack)
121
+ assert 1, ac_span[:ec]
122
+ end
123
+
81
124
  def test_404
82
125
  clear_all!
83
126
 
@@ -86,8 +129,28 @@ class ActionControllerTest < Minitest::Test
86
129
  spans = ::Instana.processor.queued_spans
87
130
  assert_equal 1, spans.length
88
131
 
89
- first_span = spans[0]
132
+ rack_span = find_first_span_by_name(spans, :rack)
90
133
 
91
- assert_equal :rack, first_span[:n]
134
+ assert_equal false, rack_span.key?(:error)
135
+ assert_equal 404, rack_span[:data][:http][:status]
136
+ end
137
+
138
+ def test_raise_routing_error
139
+ clear_all!
140
+
141
+ Net::HTTP.get(URI.parse('http://localhost:3205/test/raise_route_error'))
142
+
143
+ spans = ::Instana.processor.queued_spans
144
+ assert_equal 2, spans.length
145
+
146
+ rack_span = find_first_span_by_name(spans, :rack)
147
+ ac_span = find_first_span_by_name(spans, :actioncontroller)
148
+
149
+ assert_equal false, rack_span.key?(:error)
150
+ assert_equal 404, rack_span[:data][:http][:status]
151
+
152
+ assert_equal true, ac_span[:error]
153
+ assert ac_span.key?(:stack)
154
+ assert 1, ac_span[:ec]
92
155
  end
93
156
  end
@@ -39,9 +39,11 @@ class RailsTestApp < Rails::Application
39
39
  get "/test/render_js" => "test#render_js"
40
40
  get "/test/render_alternate_layout" => "test#render_alternate_layout"
41
41
  get "/test/render_partial_that_errors" => "test#render_partial_that_errors"
42
+ get "/test/raise_route_error" => "test#raise_route_error"
42
43
 
43
44
  get "/api/world" => "socket#world"
44
45
  get "/api/error" => "socket#error"
46
+ get "/api/raise_route_error" => "socket#raise_route_error"
45
47
  end
46
48
 
47
49
  # Enable cache classes. Production style.
@@ -172,6 +174,10 @@ class TestController < ActionController::Base
172
174
  def error
173
175
  raise Exception.new("Warning: This is a simulated Error")
174
176
  end
177
+
178
+ def raise_route_error
179
+ raise ActionController::RoutingError.new('Simulated not found')
180
+ end
175
181
  end
176
182
 
177
183
  if ::Rails::VERSION::MAJOR > 4
@@ -184,6 +190,10 @@ if ::Rails::VERSION::MAJOR > 4
184
190
  end
185
191
  end
186
192
 
193
+ def raise_route_error
194
+ raise ActionController::RoutingError.new('Simulated not found')
195
+ end
196
+
187
197
  def error
188
198
  raise Exception.new("Warning: This is a simulated Socket API Error")
189
199
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.9
4
+ version: 1.10.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-07 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler