traceview 3.0.2-java → 3.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +39 -14
  3. data/Gemfile +4 -62
  4. data/Rakefile +23 -8
  5. data/gemfiles/frameworks.gemfile +40 -0
  6. data/gemfiles/libraries.gemfile +78 -0
  7. data/gemfiles/rails23.gemfile +47 -0
  8. data/gemfiles/rails30.gemfile +47 -0
  9. data/gemfiles/rails31.gemfile +47 -0
  10. data/gemfiles/rails32.gemfile +47 -0
  11. data/gemfiles/rails40.gemfile +35 -0
  12. data/gemfiles/rails41.gemfile +35 -0
  13. data/gemfiles/rails42.gemfile +35 -0
  14. data/lib/traceview/api/logging.rb +84 -38
  15. data/lib/traceview/frameworks/rails/inst/action_controller.rb +1 -1
  16. data/lib/traceview/inst/moped.rb +2 -2
  17. data/lib/traceview/util.rb +30 -34
  18. data/lib/traceview/version.rb +1 -1
  19. data/test/frameworks/apps/grape_nested.rb +3 -0
  20. data/test/frameworks/apps/grape_simple.rb +3 -0
  21. data/test/frameworks/apps/sinatra_simple.rb +3 -0
  22. data/test/frameworks/grape_test.rb +8 -4
  23. data/test/frameworks/padrino_test.rb +6 -2
  24. data/test/frameworks/rails2x_test.rb +3 -0
  25. data/test/frameworks/rails3x_test.rb +91 -0
  26. data/test/frameworks/rails4x_test.rb +89 -0
  27. data/test/frameworks/sinatra_test.rb +3 -0
  28. data/test/instrumentation/cassandra_test.rb +11 -4
  29. data/test/instrumentation/dalli_test.rb +3 -0
  30. data/test/instrumentation/em_http_request_test.rb +3 -0
  31. data/test/instrumentation/excon_test.rb +3 -0
  32. data/test/instrumentation/faraday_test.rb +3 -0
  33. data/test/instrumentation/http_test.rb +3 -0
  34. data/test/instrumentation/httpclient_test.rb +3 -0
  35. data/test/instrumentation/memcache_test.rb +9 -0
  36. data/test/instrumentation/memcached_test.rb +3 -0
  37. data/test/instrumentation/mongo_test.rb +14 -3
  38. data/test/instrumentation/moped_test.rb +29 -6
  39. data/test/instrumentation/rack_test.rb +3 -0
  40. data/test/instrumentation/redis_hashes_test.rb +187 -184
  41. data/test/instrumentation/redis_keys_test.rb +223 -220
  42. data/test/instrumentation/redis_lists_test.rb +225 -225
  43. data/test/instrumentation/redis_misc_test.rb +123 -120
  44. data/test/instrumentation/redis_sets_test.rb +216 -213
  45. data/test/instrumentation/redis_sortedsets_test.rb +245 -242
  46. data/test/instrumentation/redis_strings_test.rb +242 -238
  47. data/test/instrumentation/resque_test.rb +3 -0
  48. data/test/instrumentation/rest-client_test.rb +3 -0
  49. data/test/instrumentation/sequel_mysql2_test.rb +4 -1
  50. data/test/instrumentation/sequel_mysql_test.rb +4 -1
  51. data/test/instrumentation/sequel_pg_test.rb +4 -1
  52. data/test/minitest_helper.rb +25 -8
  53. data/test/profiling/method_test.rb +3 -0
  54. data/test/servers/rackapp_8101.rb +1 -1
  55. data/test/servers/rails2x_8140.rb +2 -2
  56. data/test/servers/rails3x_8140.rb +78 -0
  57. data/test/servers/rails4x_8140.rb +78 -0
  58. data/test/support/backcompat_test.rb +3 -0
  59. data/test/support/config_test.rb +3 -0
  60. data/test/support/dnt_test.rb +3 -0
  61. data/test/support/liboboe_settings_test.rb +3 -0
  62. data/test/support/tvalias_test.rb +3 -0
  63. data/test/support/xtrace_test.rb +3 -0
  64. metadata +19 -5
  65. data/Appraisals +0 -10
  66. data/gemfiles/mongo.gemfile +0 -33
  67. data/gemfiles/moped.gemfile +0 -33
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  require 'minitest_helper'
2
5
  require 'rack/test'
3
6
  require 'rack/lobster'
@@ -1,265 +1,268 @@
1
+ # Copyright (c) 2015 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  require 'minitest_helper'
2
- require "redis"
3
5
 
4
- describe "Redis Hashes" do
5
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
+ if defined?(::Redis)
7
+ describe "Redis Hashes" do
8
+ attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
9
 
7
- def min_server_version(version)
8
- unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
9
- skip "supported only on redis-server #{version} or greater"
10
+ def min_server_version(version)
11
+ unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
12
+ skip "supported only on redis-server #{version} or greater"
13
+ end
10
14
  end
11
- end
12
15
 
13
- before do
14
- clear_all_traces
16
+ before do
17
+ clear_all_traces
15
18
 
16
- @redis ||= Redis.new
19
+ @redis ||= Redis.new
17
20
 
18
- @redis_version ||= @redis.info["redis_version"]
21
+ @redis_version ||= @redis.info["redis_version"]
19
22
 
20
- # These are standard entry/exit KVs that are passed up with all moped operations
21
- @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
22
- @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
23
- end
23
+ # These are standard entry/exit KVs that are passed up with all moped operations
24
+ @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
25
+ @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
26
+ end
24
27
 
25
- it 'Stock Redis should be loaded, defined and ready' do
26
- defined?(::Redis).wont_match nil
27
- end
28
+ it 'Stock Redis should be loaded, defined and ready' do
29
+ defined?(::Redis).wont_match nil
30
+ end
31
+
32
+ it "should trace hdel" do
33
+ min_server_version(2.0)
28
34
 
29
- it "should trace hdel" do
30
- min_server_version(2.0)
35
+ @redis.hset("whale", "color", "blue")
31
36
 
32
- @redis.hset("whale", "color", "blue")
37
+ TraceView::API.start_trace('redis_test', '', {}) do
38
+ @redis.hdel("whale", "color")
39
+ end
33
40
 
34
- TraceView::API.start_trace('redis_test', '', {}) do
35
- @redis.hdel("whale", "color")
41
+ traces = get_all_traces
42
+ traces.count.must_equal 4
43
+ traces[2]['KVOp'].must_equal "hdel"
44
+ traces[2]['KVKey'].must_equal "whale"
45
+ traces[2]['field'].must_equal "color"
36
46
  end
37
47
 
38
- traces = get_all_traces
39
- traces.count.must_equal 4
40
- traces[2]['KVOp'].must_equal "hdel"
41
- traces[2]['KVKey'].must_equal "whale"
42
- traces[2]['field'].must_equal "color"
43
- end
48
+ it "should trace hdel multiple fields" do
49
+ min_server_version(2.4)
44
50
 
45
- it "should trace hdel multiple fields" do
46
- min_server_version(2.4)
51
+ @redis.hset("whale", "color", "blue")
52
+ @redis.hset("whale", "size", "big")
53
+ @redis.hset("whale", "eyes", "green")
47
54
 
48
- @redis.hset("whale", "color", "blue")
49
- @redis.hset("whale", "size", "big")
50
- @redis.hset("whale", "eyes", "green")
55
+ TraceView::API.start_trace('redis_test', '', {}) do
56
+ @redis.hdel("whale", ["color", "eyes"])
57
+ end
51
58
 
52
- TraceView::API.start_trace('redis_test', '', {}) do
53
- @redis.hdel("whale", ["color", "eyes"])
59
+ traces = get_all_traces
60
+ traces.count.must_equal 4
61
+ traces[2]['KVOp'].must_equal "hdel"
62
+ traces[2]['KVKey'].must_equal "whale"
63
+ traces[2].has_key?('field').must_equal false
54
64
  end
55
65
 
56
- traces = get_all_traces
57
- traces.count.must_equal 4
58
- traces[2]['KVOp'].must_equal "hdel"
59
- traces[2]['KVKey'].must_equal "whale"
60
- traces[2].has_key?('field').must_equal false
61
- end
66
+ it "should trace hexists" do
67
+ min_server_version(2.0)
62
68
 
63
- it "should trace hexists" do
64
- min_server_version(2.0)
69
+ @redis.hset("whale", "color", "blue")
65
70
 
66
- @redis.hset("whale", "color", "blue")
71
+ TraceView::API.start_trace('redis_test', '', {}) do
72
+ @redis.hexists("whale", "color")
73
+ end
67
74
 
68
- TraceView::API.start_trace('redis_test', '', {}) do
69
- @redis.hexists("whale", "color")
75
+ traces = get_all_traces
76
+ traces.count.must_equal 4
77
+ traces[2]['KVOp'].must_equal "hexists"
78
+ traces[2]['KVKey'].must_equal "whale"
79
+ traces[2]['field'].must_equal "color"
70
80
  end
71
81
 
72
- traces = get_all_traces
73
- traces.count.must_equal 4
74
- traces[2]['KVOp'].must_equal "hexists"
75
- traces[2]['KVKey'].must_equal "whale"
76
- traces[2]['field'].must_equal "color"
77
- end
82
+ it "should trace hget" do
83
+ min_server_version(2.0)
78
84
 
79
- it "should trace hget" do
80
- min_server_version(2.0)
85
+ @redis.hset("whale", "color", "blue")
81
86
 
82
- @redis.hset("whale", "color", "blue")
87
+ TraceView::API.start_trace('redis_test', '', {}) do
88
+ @redis.hget("whale", "color")
89
+ @redis.hget("whale", "noexist")
90
+ end
83
91
 
84
- TraceView::API.start_trace('redis_test', '', {}) do
85
- @redis.hget("whale", "color")
86
- @redis.hget("whale", "noexist")
92
+ traces = get_all_traces
93
+ traces.count.must_equal 6
94
+ traces[2]['KVOp'].must_equal "hget"
95
+ traces[2]['KVKey'].must_equal "whale"
96
+ traces[2]['KVHit'].must_equal 1
97
+ traces[2]['field'].must_equal "color"
98
+ traces[4]['KVHit'].must_equal 0
87
99
  end
88
100
 
89
- traces = get_all_traces
90
- traces.count.must_equal 6
91
- traces[2]['KVOp'].must_equal "hget"
92
- traces[2]['KVKey'].must_equal "whale"
93
- traces[2]['KVHit'].must_equal 1
94
- traces[2]['field'].must_equal "color"
95
- traces[4]['KVHit'].must_equal 0
96
- end
101
+ it "should trace hgetall" do
102
+ min_server_version(2.0)
97
103
 
98
- it "should trace hgetall" do
99
- min_server_version(2.0)
104
+ @redis.hset("whale", "color", "blue")
100
105
 
101
- @redis.hset("whale", "color", "blue")
106
+ TraceView::API.start_trace('redis_test', '', {}) do
107
+ @redis.hgetall("whale")
108
+ end
102
109
 
103
- TraceView::API.start_trace('redis_test', '', {}) do
104
- @redis.hgetall("whale")
110
+ traces = get_all_traces
111
+ traces.count.must_equal 4
112
+ traces[2]['KVOp'].must_equal "hgetall"
113
+ traces[2]['KVKey'].must_equal "whale"
105
114
  end
106
115
 
107
- traces = get_all_traces
108
- traces.count.must_equal 4
109
- traces[2]['KVOp'].must_equal "hgetall"
110
- traces[2]['KVKey'].must_equal "whale"
111
- end
116
+ it "should trace hincrby" do
117
+ min_server_version(2.0)
112
118
 
113
- it "should trace hincrby" do
114
- min_server_version(2.0)
119
+ @redis.hset("whale", "age", 32)
115
120
 
116
- @redis.hset("whale", "age", 32)
121
+ TraceView::API.start_trace('redis_test', '', {}) do
122
+ @redis.hincrby("whale", "age", 1)
123
+ end
117
124
 
118
- TraceView::API.start_trace('redis_test', '', {}) do
119
- @redis.hincrby("whale", "age", 1)
125
+ traces = get_all_traces
126
+ traces.count.must_equal 4
127
+ traces[2]['KVOp'].must_equal "hincrby"
128
+ traces[2]['KVKey'].must_equal "whale"
129
+ traces[2]['field'].must_equal "age"
130
+ traces[2]['increment'].must_equal 1
120
131
  end
121
132
 
122
- traces = get_all_traces
123
- traces.count.must_equal 4
124
- traces[2]['KVOp'].must_equal "hincrby"
125
- traces[2]['KVKey'].must_equal "whale"
126
- traces[2]['field'].must_equal "age"
127
- traces[2]['increment'].must_equal 1
128
- end
133
+ it "should trace hincrbyfloat" do
134
+ min_server_version(2.6)
129
135
 
130
- it "should trace hincrbyfloat" do
131
- min_server_version(2.6)
136
+ @redis.hset("whale", "age", 32)
132
137
 
133
- @redis.hset("whale", "age", 32)
138
+ TraceView::API.start_trace('redis_test', '', {}) do
139
+ @redis.hincrbyfloat("whale", "age", 1.3)
140
+ end
134
141
 
135
- TraceView::API.start_trace('redis_test', '', {}) do
136
- @redis.hincrbyfloat("whale", "age", 1.3)
142
+ traces = get_all_traces
143
+ traces.count.must_equal 4
144
+ traces[2]['KVOp'].must_equal "hincrbyfloat"
145
+ traces[2]['KVKey'].must_equal "whale"
146
+ traces[2]['field'].must_equal "age"
147
+ traces[2]['increment'].must_equal 1.3
137
148
  end
138
149
 
139
- traces = get_all_traces
140
- traces.count.must_equal 4
141
- traces[2]['KVOp'].must_equal "hincrbyfloat"
142
- traces[2]['KVKey'].must_equal "whale"
143
- traces[2]['field'].must_equal "age"
144
- traces[2]['increment'].must_equal 1.3
145
- end
150
+ it "should trace hkeys" do
151
+ min_server_version(2.0)
146
152
 
147
- it "should trace hkeys" do
148
- min_server_version(2.0)
153
+ @redis.hset("whale", "age", 32)
149
154
 
150
- @redis.hset("whale", "age", 32)
155
+ TraceView::API.start_trace('redis_test', '', {}) do
156
+ @redis.hkeys("whale")
157
+ end
151
158
 
152
- TraceView::API.start_trace('redis_test', '', {}) do
153
- @redis.hkeys("whale")
159
+ traces = get_all_traces
160
+ traces.count.must_equal 4
161
+ traces[2]['KVOp'].must_equal "hkeys"
162
+ traces[2]['KVKey'].must_equal "whale"
154
163
  end
155
164
 
156
- traces = get_all_traces
157
- traces.count.must_equal 4
158
- traces[2]['KVOp'].must_equal "hkeys"
159
- traces[2]['KVKey'].must_equal "whale"
160
- end
165
+ it "should trace hlen" do
166
+ min_server_version(2.0)
161
167
 
162
- it "should trace hlen" do
163
- min_server_version(2.0)
168
+ @redis.hset("whale", "age", 32)
164
169
 
165
- @redis.hset("whale", "age", 32)
170
+ TraceView::API.start_trace('redis_test', '', {}) do
171
+ @redis.hlen("whale")
172
+ end
166
173
 
167
- TraceView::API.start_trace('redis_test', '', {}) do
168
- @redis.hlen("whale")
174
+ traces = get_all_traces
175
+ traces.count.must_equal 4
176
+ traces[2]['KVOp'].must_equal "hlen"
177
+ traces[2]['KVKey'].must_equal "whale"
169
178
  end
170
179
 
171
- traces = get_all_traces
172
- traces.count.must_equal 4
173
- traces[2]['KVOp'].must_equal "hlen"
174
- traces[2]['KVKey'].must_equal "whale"
175
- end
180
+ it "should trace hmget" do
181
+ min_server_version(2.0)
176
182
 
177
- it "should trace hmget" do
178
- min_server_version(2.0)
183
+ @redis.hset("whale", "color", "blue")
184
+ @redis.hset("whale", "size", "big")
185
+ @redis.hset("whale", "eyes", "green")
179
186
 
180
- @redis.hset("whale", "color", "blue")
181
- @redis.hset("whale", "size", "big")
182
- @redis.hset("whale", "eyes", "green")
187
+ TraceView::API.start_trace('redis_test', '', {}) do
188
+ @redis.hmget("whale", "color", "size", "blah", "brown")
189
+ end
183
190
 
184
- TraceView::API.start_trace('redis_test', '', {}) do
185
- @redis.hmget("whale", "color", "size", "blah", "brown")
191
+ traces = get_all_traces
192
+ traces.count.must_equal 4
193
+ traces[2]['KVOp'].must_equal "hmget"
194
+ traces[2]['KVKey'].must_equal "whale"
195
+ traces[2]['KVKeyCount'].must_equal 4
196
+ traces[2]['KVHitCount'].must_equal 2
186
197
  end
187
198
 
188
- traces = get_all_traces
189
- traces.count.must_equal 4
190
- traces[2]['KVOp'].must_equal "hmget"
191
- traces[2]['KVKey'].must_equal "whale"
192
- traces[2]['KVKeyCount'].must_equal 4
193
- traces[2]['KVHitCount'].must_equal 2
194
- end
199
+ it "should trace hmset" do
200
+ min_server_version(2.0)
195
201
 
196
- it "should trace hmset" do
197
- min_server_version(2.0)
202
+ @redis.hset("whale", "color", "blue")
203
+ @redis.hset("whale", "size", "big")
204
+ @redis.hset("whale", "eyes", "green")
198
205
 
199
- @redis.hset("whale", "color", "blue")
200
- @redis.hset("whale", "size", "big")
201
- @redis.hset("whale", "eyes", "green")
206
+ TraceView::API.start_trace('redis_test', '', {}) do
207
+ @redis.hmset("whale", ["color", "red", "size", "very big"])
208
+ end
202
209
 
203
- TraceView::API.start_trace('redis_test', '', {}) do
204
- @redis.hmset("whale", ["color", "red", "size", "very big"])
210
+ traces = get_all_traces
211
+ traces.count.must_equal 4
212
+ traces[2]['KVOp'].must_equal "hmset"
213
+ traces[2]['KVKey'].must_equal "whale"
205
214
  end
206
215
 
207
- traces = get_all_traces
208
- traces.count.must_equal 4
209
- traces[2]['KVOp'].must_equal "hmset"
210
- traces[2]['KVKey'].must_equal "whale"
211
- end
216
+ it "should trace hset" do
217
+ min_server_version(2.0)
212
218
 
213
- it "should trace hset" do
214
- min_server_version(2.0)
219
+ TraceView::API.start_trace('redis_test', '', {}) do
220
+ @redis.hset("whale", "eyes", "green")
221
+ end
215
222
 
216
- TraceView::API.start_trace('redis_test', '', {}) do
217
- @redis.hset("whale", "eyes", "green")
223
+ traces = get_all_traces
224
+ traces.count.must_equal 4
225
+ traces[2]['KVOp'].must_equal "hset"
226
+ traces[2]['KVKey'].must_equal "whale"
218
227
  end
219
228
 
220
- traces = get_all_traces
221
- traces.count.must_equal 4
222
- traces[2]['KVOp'].must_equal "hset"
223
- traces[2]['KVKey'].must_equal "whale"
224
- end
229
+ it "should trace hsetnx" do
230
+ min_server_version(2.0)
225
231
 
226
- it "should trace hsetnx" do
227
- min_server_version(2.0)
232
+ TraceView::API.start_trace('redis_test', '', {}) do
233
+ @redis.hsetnx("whale", "eyes", "green")
234
+ end
228
235
 
229
- TraceView::API.start_trace('redis_test', '', {}) do
230
- @redis.hsetnx("whale", "eyes", "green")
236
+ traces = get_all_traces
237
+ traces.count.must_equal 4
238
+ traces[2]['KVOp'].must_equal "hsetnx"
239
+ traces[2]['KVKey'].must_equal "whale"
231
240
  end
232
241
 
233
- traces = get_all_traces
234
- traces.count.must_equal 4
235
- traces[2]['KVOp'].must_equal "hsetnx"
236
- traces[2]['KVKey'].must_equal "whale"
237
- end
242
+ it "should trace hvals" do
243
+ min_server_version(2.0)
238
244
 
239
- it "should trace hvals" do
240
- min_server_version(2.0)
245
+ TraceView::API.start_trace('redis_test', '', {}) do
246
+ @redis.hvals("whale")
247
+ end
241
248
 
242
- TraceView::API.start_trace('redis_test', '', {}) do
243
- @redis.hvals("whale")
249
+ traces = get_all_traces
250
+ traces.count.must_equal 4
251
+ traces[2]['KVOp'].must_equal "hvals"
252
+ traces[2]['KVKey'].must_equal "whale"
244
253
  end
245
254
 
246
- traces = get_all_traces
247
- traces.count.must_equal 4
248
- traces[2]['KVOp'].must_equal "hvals"
249
- traces[2]['KVKey'].must_equal "whale"
250
- end
255
+ it "should trace hscan" do
256
+ min_server_version(2.8)
251
257
 
252
- it "should trace hscan" do
253
- min_server_version(2.8)
258
+ TraceView::API.start_trace('redis_test', '', {}) do
259
+ @redis.hscan("whale", 0)
260
+ end
254
261
 
255
- TraceView::API.start_trace('redis_test', '', {}) do
256
- @redis.hscan("whale", 0)
262
+ traces = get_all_traces
263
+ traces.count.must_equal 4
264
+ traces[2]['KVOp'].must_equal "hscan"
265
+ traces[2]['KVKey'].must_equal "whale"
257
266
  end
258
-
259
- traces = get_all_traces
260
- traces.count.must_equal 4
261
- traces[2]['KVOp'].must_equal "hscan"
262
- traces[2]['KVKey'].must_equal "whale"
263
267
  end
264
268
  end
265
-