traceview 3.8.0-java → 3.8.1-java

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +3 -3
  4. data/lib/joboe_metal.rb +4 -4
  5. data/lib/oboe_metal.rb +3 -3
  6. data/lib/traceview/api/layerinit.rb +2 -2
  7. data/lib/traceview/api/logging.rb +12 -12
  8. data/lib/traceview/api/profiling.rb +6 -6
  9. data/lib/traceview/api/tracing.rb +1 -1
  10. data/lib/traceview/api/util.rb +1 -1
  11. data/lib/traceview/base.rb +14 -7
  12. data/lib/traceview/config.rb +8 -5
  13. data/lib/traceview/frameworks/padrino/templates.rb +4 -4
  14. data/lib/traceview/frameworks/rails.rb +2 -2
  15. data/lib/traceview/frameworks/rails/inst/action_controller.rb +6 -2
  16. data/lib/traceview/frameworks/rails/inst/action_controller2.rb +4 -2
  17. data/lib/traceview/frameworks/rails/inst/action_controller3.rb +5 -4
  18. data/lib/traceview/frameworks/rails/inst/action_controller4.rb +4 -2
  19. data/lib/traceview/frameworks/rails/inst/action_controller5.rb +22 -11
  20. data/lib/traceview/frameworks/rails/inst/action_controller5_api.rb +23 -12
  21. data/lib/traceview/frameworks/sinatra/templates.rb +4 -4
  22. data/lib/traceview/inst/bunny-client.rb +8 -8
  23. data/lib/traceview/inst/bunny-consumer.rb +1 -1
  24. data/lib/traceview/inst/curb.rb +19 -19
  25. data/lib/traceview/inst/dalli.rb +4 -4
  26. data/lib/traceview/inst/delayed_job.rb +4 -4
  27. data/lib/traceview/inst/em-http-request.rb +6 -6
  28. data/lib/traceview/inst/excon.rb +18 -18
  29. data/lib/traceview/inst/faraday.rb +13 -13
  30. data/lib/traceview/inst/http.rb +12 -12
  31. data/lib/traceview/inst/httpclient.rb +19 -19
  32. data/lib/traceview/inst/memcache.rb +5 -5
  33. data/lib/traceview/inst/memcached.rb +4 -4
  34. data/lib/traceview/inst/mongo.rb +6 -6
  35. data/lib/traceview/inst/moped.rb +28 -28
  36. data/lib/traceview/inst/rack.rb +24 -24
  37. data/lib/traceview/inst/redis.rb +6 -6
  38. data/lib/traceview/inst/resque.rb +6 -6
  39. data/lib/traceview/inst/rest-client.rb +4 -4
  40. data/lib/traceview/inst/sequel.rb +12 -12
  41. data/lib/traceview/inst/sidekiq-client.rb +3 -3
  42. data/lib/traceview/inst/sidekiq-worker.rb +3 -3
  43. data/lib/traceview/inst/twitter-cassandra.rb +17 -17
  44. data/lib/traceview/inst/typhoeus.rb +13 -13
  45. data/lib/traceview/method_profiling.rb +2 -2
  46. data/lib/traceview/ruby.rb +1 -1
  47. data/lib/traceview/util.rb +4 -4
  48. data/lib/traceview/version.rb +1 -1
  49. data/test/frameworks/rails3x_test.rb +105 -0
  50. data/test/frameworks/rails4x_test.rb +97 -0
  51. data/test/frameworks/rails5x_api_test.rb +98 -1
  52. data/test/frameworks/rails5x_test.rb +99 -2
  53. data/test/profiling/legacy_method_profiling_test.rb +1 -1
  54. data/test/support/backcompat_test.rb +2 -2
  55. data/test/support/config_test.rb +1 -1
  56. metadata +2 -2
@@ -8,11 +8,15 @@ if defined?(::Rails)
8
8
  describe "Rails5xAPI" do
9
9
  before do
10
10
  clear_all_traces
11
+ @collect_backtraces = TraceView::Config[:action_controller][:collect_backtraces]
11
12
  ENV['DBTYPE'] = "postgresql" unless ENV['DBTYPE']
12
13
  end
13
14
 
14
- it "should trace a request to a rails api stack" do
15
+ after do
16
+ TraceView::Config[:action_controller][:collect_backtraces] = @collect_backtraces
17
+ end
15
18
 
19
+ it "should trace a request to a rails api stack" do
16
20
  uri = URI.parse('http://127.0.0.1:8150/monkey/hello')
17
21
  r = Net::HTTP.get_response(uri)
18
22
 
@@ -99,5 +103,98 @@ if defined?(::Rails)
99
103
  r.header['X-Trace'].must_equal traces[5]['X-Trace']
100
104
  end
101
105
 
106
+ it "should collect backtraces when true" do
107
+ TraceView::Config[:action_controller_api][:collect_backtraces] = true
108
+
109
+ uri = URI.parse('http://127.0.0.1:8150/monkey/hello')
110
+ r = Net::HTTP.get_response(uri)
111
+
112
+ traces = get_all_traces
113
+
114
+ traces.count.must_equal 7
115
+ unless defined?(JRUBY_VERSION)
116
+ # We don't test this under JRuby because the Java instrumentation
117
+ # for the DB drivers doesn't use our test reporter hence we won't
118
+ # see all trace events. :-( To be improved.
119
+ valid_edges?(traces).must_equal true
120
+ end
121
+ validate_outer_layers(traces, 'rack')
122
+
123
+ traces[0]['Layer'].must_equal "rack"
124
+ traces[0]['Label'].must_equal "entry"
125
+ traces[0]['URL'].must_equal "/monkey/hello"
126
+
127
+ traces[1]['Layer'].must_equal "rack"
128
+ traces[1]['Label'].must_equal "info"
129
+
130
+ traces[2]['Layer'].must_equal "rails-api"
131
+ traces[2]['Label'].must_equal "entry"
132
+ traces[2]['Controller'].must_equal "MonkeyController"
133
+ traces[2]['Action'].must_equal "hello"
134
+ traces[2].key?('Backtrace').must_equal true
135
+
136
+ traces[3]['Layer'].must_equal "actionview"
137
+ traces[3]['Label'].must_equal "entry"
138
+
139
+ traces[4]['Layer'].must_equal "actionview"
140
+ traces[4]['Label'].must_equal "exit"
141
+
142
+ traces[5]['Layer'].must_equal "rails-api"
143
+ traces[5]['Label'].must_equal "exit"
144
+
145
+ traces[6]['Layer'].must_equal "rack"
146
+ traces[6]['Label'].must_equal "exit"
147
+
148
+ # Validate the existence of the response header
149
+ r.header.key?('X-Trace').must_equal true
150
+ r.header['X-Trace'].must_equal traces[6]['X-Trace']
151
+ end
152
+
153
+ it "should NOT collect backtraces when false" do
154
+ TraceView::Config[:action_controller_api][:collect_backtraces] = false
155
+
156
+ uri = URI.parse('http://127.0.0.1:8150/monkey/hello')
157
+ r = Net::HTTP.get_response(uri)
158
+
159
+ traces = get_all_traces
160
+
161
+ traces.count.must_equal 7
162
+ unless defined?(JRUBY_VERSION)
163
+ # We don't test this under JRuby because the Java instrumentation
164
+ # for the DB drivers doesn't use our test reporter hence we won't
165
+ # see all trace events. :-( To be improved.
166
+ valid_edges?(traces).must_equal true
167
+ end
168
+ validate_outer_layers(traces, 'rack')
169
+
170
+ traces[0]['Layer'].must_equal "rack"
171
+ traces[0]['Label'].must_equal "entry"
172
+ traces[0]['URL'].must_equal "/monkey/hello"
173
+
174
+ traces[1]['Layer'].must_equal "rack"
175
+ traces[1]['Label'].must_equal "info"
176
+
177
+ traces[2]['Layer'].must_equal "rails-api"
178
+ traces[2]['Label'].must_equal "entry"
179
+ traces[2]['Controller'].must_equal "MonkeyController"
180
+ traces[2]['Action'].must_equal "hello"
181
+ traces[2].key?('Backtrace').must_equal false
182
+
183
+ traces[3]['Layer'].must_equal "actionview"
184
+ traces[3]['Label'].must_equal "entry"
185
+
186
+ traces[4]['Layer'].must_equal "actionview"
187
+ traces[4]['Label'].must_equal "exit"
188
+
189
+ traces[5]['Layer'].must_equal "rails-api"
190
+ traces[5]['Label'].must_equal "exit"
191
+
192
+ traces[6]['Layer'].must_equal "rack"
193
+ traces[6]['Label'].must_equal "exit"
194
+
195
+ # Validate the existence of the response header
196
+ r.header.key?('X-Trace').must_equal true
197
+ r.header['X-Trace'].must_equal traces[6]['X-Trace']
198
+ end
102
199
  end
103
200
  end
@@ -8,17 +8,20 @@ if defined?(::Rails)
8
8
  describe "Rails5x" do
9
9
  before do
10
10
  clear_all_traces
11
+ @collect_backtraces = TraceView::Config[:action_controller][:collect_backtraces]
11
12
  ENV['DBTYPE'] = "postgresql" unless ENV['DBTYPE']
12
13
  end
13
14
 
14
- it "should trace a request to a rails stack" do
15
+ after do
16
+ TraceView::Config[:action_controller][:collect_backtraces] = @collect_backtraces
17
+ end
15
18
 
19
+ it "should trace a request to a rails stack" do
16
20
  uri = URI.parse('http://127.0.0.1:8140/hello/world')
17
21
  r = Net::HTTP.get_response(uri)
18
22
 
19
23
  traces = get_all_traces
20
24
 
21
-
22
25
  traces.count.must_equal 7
23
26
  unless defined?(JRUBY_VERSION)
24
27
  # We don't test this under JRuby because the Java instrumentation
@@ -209,5 +212,99 @@ if defined?(::Rails)
209
212
  r.header.key?('X-Trace').must_equal true
210
213
  r.header['X-Trace'].must_equal traces[4]['X-Trace']
211
214
  end
215
+
216
+ it "should collect backtraces when true" do
217
+ TraceView::Config[:action_controller][:collect_backtraces] = true
218
+
219
+ uri = URI.parse('http://127.0.0.1:8140/hello/world')
220
+ r = Net::HTTP.get_response(uri)
221
+
222
+ traces = get_all_traces
223
+
224
+ traces.count.must_equal 7
225
+ unless defined?(JRUBY_VERSION)
226
+ # We don't test this under JRuby because the Java instrumentation
227
+ # for the DB drivers doesn't use our test reporter hence we won't
228
+ # see all trace events. :-( To be improved.
229
+ valid_edges?(traces).must_equal true
230
+ end
231
+ validate_outer_layers(traces, 'rack')
232
+
233
+ traces[0]['Layer'].must_equal "rack"
234
+ traces[0]['Label'].must_equal "entry"
235
+ traces[0]['URL'].must_equal "/hello/world"
236
+
237
+ traces[1]['Layer'].must_equal "rack"
238
+ traces[1]['Label'].must_equal "info"
239
+
240
+ traces[2]['Layer'].must_equal "rails"
241
+ traces[2]['Label'].must_equal "entry"
242
+ traces[2]['Controller'].must_equal "HelloController"
243
+ traces[2]['Action'].must_equal "world"
244
+ traces[2].key?('Backtrace').must_equal true
245
+
246
+ traces[3]['Layer'].must_equal "actionview"
247
+ traces[3]['Label'].must_equal "entry"
248
+
249
+ traces[4]['Layer'].must_equal "actionview"
250
+ traces[4]['Label'].must_equal "exit"
251
+
252
+ traces[5]['Layer'].must_equal "rails"
253
+ traces[5]['Label'].must_equal "exit"
254
+
255
+ traces[6]['Layer'].must_equal "rack"
256
+ traces[6]['Label'].must_equal "exit"
257
+
258
+ # Validate the existence of the response header
259
+ r.header.key?('X-Trace').must_equal true
260
+ r.header['X-Trace'].must_equal traces[6]['X-Trace']
261
+ end
262
+
263
+ it "should NOT collect backtraces when false" do
264
+ TraceView::Config[:action_controller][:collect_backtraces] = false
265
+
266
+ uri = URI.parse('http://127.0.0.1:8140/hello/world')
267
+ r = Net::HTTP.get_response(uri)
268
+
269
+ traces = get_all_traces
270
+
271
+ traces.count.must_equal 7
272
+ unless defined?(JRUBY_VERSION)
273
+ # We don't test this under JRuby because the Java instrumentation
274
+ # for the DB drivers doesn't use our test reporter hence we won't
275
+ # see all trace events. :-( To be improved.
276
+ valid_edges?(traces).must_equal true
277
+ end
278
+ validate_outer_layers(traces, 'rack')
279
+
280
+ traces[0]['Layer'].must_equal "rack"
281
+ traces[0]['Label'].must_equal "entry"
282
+ traces[0]['URL'].must_equal "/hello/world"
283
+
284
+ traces[1]['Layer'].must_equal "rack"
285
+ traces[1]['Label'].must_equal "info"
286
+
287
+ traces[2]['Layer'].must_equal "rails"
288
+ traces[2]['Label'].must_equal "entry"
289
+ traces[2]['Controller'].must_equal "HelloController"
290
+ traces[2]['Action'].must_equal "world"
291
+ traces[2].key?('Backtrace').must_equal false
292
+
293
+ traces[3]['Layer'].must_equal "actionview"
294
+ traces[3]['Label'].must_equal "entry"
295
+
296
+ traces[4]['Layer'].must_equal "actionview"
297
+ traces[4]['Label'].must_equal "exit"
298
+
299
+ traces[5]['Layer'].must_equal "rails"
300
+ traces[5]['Label'].must_equal "exit"
301
+
302
+ traces[6]['Layer'].must_equal "rack"
303
+ traces[6]['Label'].must_equal "exit"
304
+
305
+ # Validate the existence of the response header
306
+ r.header.key?('X-Trace').must_equal true
307
+ r.header['X-Trace'].must_equal traces[6]['X-Trace']
308
+ end
212
309
  end
213
310
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'minitest_helper'
5
5
 
6
- describe "TraceViewMethodProfiling" do
6
+ describe "LegacyTraceViewMethodProfiling" do
7
7
  before do
8
8
  clear_all_traces
9
9
  # Conditionally Undefine TestWorker
@@ -30,8 +30,8 @@ describe "BackwardCompatibility" do
30
30
  TraceView::Config.sample_rate.must_equal 8e5
31
31
 
32
32
  Oboe::Config[:tracing_mode] = 'always'
33
- Oboe::Config.tracing_mode.must_equal 'always'
34
- TraceView::Config.tracing_mode.must_equal 'always'
33
+ Oboe::Config.tracing_mode.must_equal :always
34
+ TraceView::Config.tracing_mode.must_equal :always
35
35
 
36
36
  Oboe::Config[:sample_rate] = @sr
37
37
  Oboe::Config[:tracing_mode] = @tm
@@ -19,7 +19,7 @@ describe "TraceView::Config" do
19
19
  #
20
20
  # TraceView::Config[:verbose].must_equal false
21
21
 
22
- TraceView::Config[:tracing_mode].must_equal "through"
22
+ TraceView::Config[:tracing_mode].must_equal :through
23
23
  TraceView::Config[:reporter_host].must_equal "127.0.0.1"
24
24
  end
25
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceview
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.8.1
5
5
  platform: java
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-22 00:00:00.000000000 Z
12
+ date: 2016-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json