appoptics_apm 4.0.3 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile_test +6 -7
  3. data/README.md +3 -3
  4. data/Rakefile +3 -2
  5. data/appoptics_apm.gemspec +2 -2
  6. data/docker-compose.yml +0 -22
  7. data/ext/oboe_metal/extconf.rb +4 -0
  8. data/lib/appoptics_apm/config.rb +11 -6
  9. data/lib/appoptics_apm/version.rb +1 -1
  10. metadata +3 -202
  11. data/gemfiles/delayed_job.gemfile +0 -36
  12. data/gemfiles/frameworks.gemfile +0 -44
  13. data/gemfiles/instrumentation_mocked.gemfile +0 -29
  14. data/gemfiles/libraries.gemfile +0 -85
  15. data/gemfiles/noop.gemfile +0 -17
  16. data/gemfiles/rails23.gemfile +0 -39
  17. data/gemfiles/rails30.gemfile +0 -42
  18. data/gemfiles/rails31.gemfile +0 -44
  19. data/gemfiles/rails32.gemfile +0 -54
  20. data/gemfiles/rails40.gemfile +0 -27
  21. data/gemfiles/rails41.gemfile +0 -27
  22. data/gemfiles/rails42.gemfile +0 -35
  23. data/gemfiles/rails50.gemfile +0 -44
  24. data/gemfiles/rails51.gemfile +0 -44
  25. data/test/benchmark/README.md +0 -65
  26. data/test/benchmark/logging_bench.rb +0 -54
  27. data/test/benchmark/with_libraries_gemfile/bunny_bench.rb +0 -69
  28. data/test/benchmark/with_rails5x_gemfile/action_controller5x_bench.rb +0 -43
  29. data/test/frameworks/apps/grape_nested.rb +0 -33
  30. data/test/frameworks/apps/grape_simple.rb +0 -80
  31. data/test/frameworks/apps/padrino_simple.rb +0 -80
  32. data/test/frameworks/apps/sinatra_simple.rb +0 -55
  33. data/test/frameworks/grape_test.rb +0 -286
  34. data/test/frameworks/padrino_test.rb +0 -222
  35. data/test/frameworks/rails3x_test.rb +0 -554
  36. data/test/frameworks/rails4x_test.rb +0 -570
  37. data/test/frameworks/rails5x_api_test.rb +0 -210
  38. data/test/frameworks/rails5x_test.rb +0 -376
  39. data/test/frameworks/rails_shared_tests.rb +0 -172
  40. data/test/frameworks/sinatra_test.rb +0 -140
  41. data/test/instrumentation/bunny_client_test.rb +0 -276
  42. data/test/instrumentation/bunny_consumer_test.rb +0 -204
  43. data/test/instrumentation/curb_test.rb +0 -398
  44. data/test/instrumentation/dalli_test.rb +0 -177
  45. data/test/instrumentation/em_http_request_test.rb +0 -89
  46. data/test/instrumentation/excon_test.rb +0 -231
  47. data/test/instrumentation/faraday_test.rb +0 -228
  48. data/test/instrumentation/http_test.rb +0 -143
  49. data/test/instrumentation/httpclient_test.rb +0 -304
  50. data/test/instrumentation/memcache_test.rb +0 -260
  51. data/test/instrumentation/memcached_test.rb +0 -229
  52. data/test/instrumentation/mongo_v1_test.rb +0 -479
  53. data/test/instrumentation/mongo_v2_index_test.rb +0 -124
  54. data/test/instrumentation/mongo_v2_test.rb +0 -584
  55. data/test/instrumentation/mongo_v2_view_test.rb +0 -435
  56. data/test/instrumentation/moped_test.rb +0 -517
  57. data/test/instrumentation/rack_test.rb +0 -165
  58. data/test/instrumentation/redis_hashes_test.rb +0 -268
  59. data/test/instrumentation/redis_keys_test.rb +0 -321
  60. data/test/instrumentation/redis_lists_test.rb +0 -310
  61. data/test/instrumentation/redis_misc_test.rb +0 -163
  62. data/test/instrumentation/redis_sets_test.rb +0 -296
  63. data/test/instrumentation/redis_sortedsets_test.rb +0 -328
  64. data/test/instrumentation/redis_strings_test.rb +0 -349
  65. data/test/instrumentation/resque_test.rb +0 -185
  66. data/test/instrumentation/rest-client_test.rb +0 -288
  67. data/test/instrumentation/sequel_mysql2_test.rb +0 -353
  68. data/test/instrumentation/sequel_mysql_test.rb +0 -334
  69. data/test/instrumentation/sequel_pg_test.rb +0 -336
  70. data/test/instrumentation/sidekiq-client_test.rb +0 -159
  71. data/test/instrumentation/sidekiq-worker_test.rb +0 -180
  72. data/test/instrumentation/twitter-cassandra_test.rb +0 -424
  73. data/test/instrumentation/typhoeus_test.rb +0 -284
  74. data/test/jobs/delayed_job/db_worker_job.rb +0 -29
  75. data/test/jobs/delayed_job/error_worker_job.rb +0 -10
  76. data/test/jobs/delayed_job/remote_call_worker_job.rb +0 -20
  77. data/test/jobs/resque/db_worker_job.rb +0 -29
  78. data/test/jobs/resque/error_worker_job.rb +0 -10
  79. data/test/jobs/resque/remote_call_worker_job.rb +0 -20
  80. data/test/jobs/sidekiq/db_worker_job.rb +0 -29
  81. data/test/jobs/sidekiq/error_worker_job.rb +0 -10
  82. data/test/jobs/sidekiq/remote_call_worker_job.rb +0 -20
  83. data/test/minitest_helper.rb +0 -277
  84. data/test/mocked/curb_mocked_test.rb +0 -324
  85. data/test/mocked/excon_mocked_test.rb +0 -174
  86. data/test/mocked/faraday_mocked_test.rb +0 -97
  87. data/test/mocked/http_mocked_test.rb +0 -135
  88. data/test/mocked/httpclient_mocked_test.rb +0 -258
  89. data/test/mocked/rest_client_mocked_test.rb +0 -109
  90. data/test/mocked/typhoeus_mocked_test.rb +0 -207
  91. data/test/models/widget.rb +0 -36
  92. data/test/noop/noop_test.rb +0 -145
  93. data/test/profiling/legacy_method_profiling_test.rb +0 -201
  94. data/test/profiling/method_profiling_test.rb +0 -631
  95. data/test/queues/delayed_job-client_test.rb +0 -95
  96. data/test/queues/delayed_job-worker_test.rb +0 -91
  97. data/test/reporter/reporter_test.rb +0 -14
  98. data/test/servers/delayed_job.rb +0 -107
  99. data/test/servers/rackapp_8101.rb +0 -29
  100. data/test/servers/rails3x_8140.rb +0 -96
  101. data/test/servers/rails4x_8140.rb +0 -96
  102. data/test/servers/rails5x_8140.rb +0 -95
  103. data/test/servers/rails5x_api_8150.rb +0 -78
  104. data/test/servers/sidekiq.rb +0 -29
  105. data/test/servers/sidekiq.yml +0 -7
  106. data/test/servers/sidekiq_initializer.rb +0 -25
  107. data/test/settings +0 -0
  108. data/test/support/auto_tracing_test.rb +0 -50
  109. data/test/support/backcompat_test.rb +0 -276
  110. data/test/support/config_test.rb +0 -149
  111. data/test/support/dnt_test.rb +0 -98
  112. data/test/support/init_report_test.rb +0 -25
  113. data/test/support/liboboe_settings_test.rb +0 -110
  114. data/test/support/logging_test.rb +0 -130
  115. data/test/support/sql_sanitize_test.rb +0 -55
  116. data/test/support/tracing_mode_test.rb +0 -33
  117. data/test/support/tvalias_test.rb +0 -15
  118. data/test/support/xtrace_test.rb +0 -41
@@ -1,165 +0,0 @@
1
- # Copyright (c) 2016 SolarWinds, LLC.
2
- # All rights reserved.
3
-
4
- require 'minitest_helper'
5
- require 'rack/test'
6
- require 'rack/lobster'
7
- require 'appoptics_apm/inst/rack'
8
- require 'mocha/mini_test'
9
-
10
- class RackTestApp < Minitest::Test
11
- include Rack::Test::Methods
12
-
13
- def app
14
- @app = Rack::Builder.new {
15
- use Rack::CommonLogger
16
- use Rack::ShowExceptions
17
- use AppOpticsAPM::Rack
18
- map "/lobster" do
19
- use Rack::Lint
20
- run Rack::Lobster.new
21
- end
22
- }
23
- end
24
-
25
- def teardown
26
- AppOpticsAPM::Config[:tracing_mode] = :always
27
- end
28
-
29
- def test_get_the_lobster
30
- skip("FIXME: broken on travis only") if ENV['TRAVIS'] == "true"
31
-
32
- clear_all_traces
33
-
34
- get "/lobster"
35
-
36
- traces = get_all_traces
37
- traces.count.must_equal 3
38
-
39
- validate_outer_layers(traces, 'rack')
40
-
41
- kvs = {}
42
- kvs["Label"] = "entry"
43
- kvs["URL"] = "/lobster"
44
- validate_event_keys(traces[0], kvs)
45
-
46
- kvs.clear
47
- kvs["Layer"] = "rack"
48
- kvs["Label"] = "info"
49
- kvs["HTTP-Host"] = "example.org"
50
- kvs["Port"] = 80
51
- kvs["Proto"] = "http"
52
- kvs["Method"] = "GET"
53
- kvs["ClientIP"] = "127.0.0.1"
54
- validate_event_keys(traces[1], kvs)
55
-
56
- assert traces[0].has_key?('SampleRate')
57
- assert traces[0].has_key?('SampleSource')
58
- assert traces[1].has_key?('ProcessID')
59
- assert traces[1].has_key?('ThreadID')
60
-
61
- assert traces[2]["Label"] == 'exit'
62
- assert traces[2]["Status"] == 200
63
-
64
- assert last_response.ok?
65
-
66
- assert last_response['X-Trace']
67
- end
68
-
69
- def test_must_return_xtrace_header
70
- clear_all_traces
71
- get "/lobster"
72
- xtrace = last_response['X-Trace']
73
- assert xtrace
74
- assert AppOpticsAPM::XTrace.valid?(xtrace)
75
- end
76
-
77
- def test_log_args_when_false
78
- clear_all_traces
79
-
80
- @log_args = AppOpticsAPM::Config[:rack][:log_args]
81
- AppOpticsAPM::Config[:rack][:log_args] = false
82
-
83
- get "/lobster?blah=1"
84
-
85
- traces = get_all_traces
86
-
87
- xtrace = last_response['X-Trace']
88
- assert xtrace
89
- assert AppOpticsAPM::XTrace.valid?(xtrace)
90
-
91
- traces[0]['URL'].must_equal "/lobster"
92
-
93
- AppOpticsAPM::Config[:rack][:log_args] = @log_args
94
- end
95
-
96
- def test_log_args_when_true
97
- clear_all_traces
98
-
99
- @log_args = AppOpticsAPM::Config[:rack][:log_args]
100
- AppOpticsAPM::Config[:rack][:log_args] = true
101
-
102
- get "/lobster?blah=1"
103
-
104
- traces = get_all_traces
105
-
106
- xtrace = last_response['X-Trace']
107
- assert xtrace
108
- assert AppOpticsAPM::XTrace.valid?(xtrace)
109
-
110
- traces[0]['URL'].must_equal "/lobster?blah=1"
111
-
112
- AppOpticsAPM::Config[:rack][:log_args] = @log_args
113
- end
114
-
115
- def test_has_header_when_not_tracing
116
- clear_all_traces
117
-
118
- AppOpticsAPM::Config[:tracing_mode] = :never
119
-
120
- get "/lobster?blah=1"
121
-
122
- traces = get_all_traces
123
- assert_equal(0, traces.size)
124
-
125
- assert last_response['X-Trace'], "X-Trace header is missing"
126
- assert not_sampled?(last_response['X-Trace']), "X-Trace sampling flag is not '00'"
127
- end
128
-
129
- def test_sends_path_in_http_span_when_no_controller
130
- test_action, test_url, test_status, test_method, test_error = nil, nil, nil, nil, nil
131
-
132
- AppOpticsAPM::Span.expects(:createHttpSpan).with do |action, url, _duration, status, method, error|
133
- test_action = action
134
- test_url = url
135
- test_status = status
136
- test_method = method
137
- test_error = error
138
- end.once
139
-
140
- get "/no/controller/here"
141
-
142
- assert_nil test_action
143
- assert_equal "http://example.org/no/controller/here", test_url
144
- assert_equal 404, test_status
145
- assert_equal "GET", test_method
146
- assert_equal 0, test_error
147
- end
148
-
149
- def test_does_not_send_http_span_for_static_assets
150
- AppOpticsAPM::Span.expects(:createHttpSpan).never
151
-
152
- get "/assets/static_asset.png"
153
- end
154
-
155
- # the status returned by @app.call(env) is usually an integer, but there are cases where it is a string
156
- # encountered by this app: https://github.com/librato/api which proxies requests "through to a java service by rack"
157
- def test_status_can_be_a_string
158
- Rack::URLMap.any_instance.stubs(:call).returns(["200", {"Content-Length"=>"592"}, "the body"])
159
-
160
- result = get '/lobster'
161
-
162
- assert_equal 200, result.status
163
- end
164
- end
165
-
@@ -1,268 +0,0 @@
1
- # Copyright (c) 2016 SolarWinds, LLC.
2
- # All rights reserved.
3
-
4
- require 'minitest_helper'
5
-
6
- if defined?(::Redis)
7
- describe "Redis Hashes" do
8
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
9
-
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
14
- end
15
-
16
- before do
17
- clear_all_traces
18
-
19
- @redis ||= Redis.new(:host => ENV['APPOPTICS_REDIS_SERVER'] || '127.0.0.1')
20
-
21
- @redis_version ||= @redis.info["redis_version"]
22
-
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
27
-
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)
34
-
35
- @redis.hset("whale", "color", "blue")
36
-
37
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
38
- @redis.hdel("whale", "color")
39
- end
40
-
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"
46
- end
47
-
48
- it "should trace hdel multiple fields" do
49
- min_server_version(2.4)
50
-
51
- @redis.hset("whale", "color", "blue")
52
- @redis.hset("whale", "size", "big")
53
- @redis.hset("whale", "eyes", "green")
54
-
55
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
56
- @redis.hdel("whale", ["color", "eyes"])
57
- end
58
-
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
64
- end
65
-
66
- it "should trace hexists" do
67
- min_server_version(2.0)
68
-
69
- @redis.hset("whale", "color", "blue")
70
-
71
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
72
- @redis.hexists("whale", "color")
73
- end
74
-
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"
80
- end
81
-
82
- it "should trace hget" do
83
- min_server_version(2.0)
84
-
85
- @redis.hset("whale", "color", "blue")
86
-
87
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
88
- @redis.hget("whale", "color")
89
- @redis.hget("whale", "noexist")
90
- end
91
-
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
99
- end
100
-
101
- it "should trace hgetall" do
102
- min_server_version(2.0)
103
-
104
- @redis.hset("whale", "color", "blue")
105
-
106
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
107
- @redis.hgetall("whale")
108
- end
109
-
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"
114
- end
115
-
116
- it "should trace hincrby" do
117
- min_server_version(2.0)
118
-
119
- @redis.hset("whale", "age", 32)
120
-
121
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
122
- @redis.hincrby("whale", "age", 1)
123
- end
124
-
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
131
- end
132
-
133
- it "should trace hincrbyfloat" do
134
- min_server_version(2.6)
135
-
136
- @redis.hset("whale", "age", 32)
137
-
138
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
139
- @redis.hincrbyfloat("whale", "age", 1.3)
140
- end
141
-
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
148
- end
149
-
150
- it "should trace hkeys" do
151
- min_server_version(2.0)
152
-
153
- @redis.hset("whale", "age", 32)
154
-
155
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
156
- @redis.hkeys("whale")
157
- end
158
-
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"
163
- end
164
-
165
- it "should trace hlen" do
166
- min_server_version(2.0)
167
-
168
- @redis.hset("whale", "age", 32)
169
-
170
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
171
- @redis.hlen("whale")
172
- end
173
-
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"
178
- end
179
-
180
- it "should trace hmget" do
181
- min_server_version(2.0)
182
-
183
- @redis.hset("whale", "color", "blue")
184
- @redis.hset("whale", "size", "big")
185
- @redis.hset("whale", "eyes", "green")
186
-
187
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
188
- @redis.hmget("whale", "color", "size", "blah", "brown")
189
- end
190
-
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
197
- end
198
-
199
- it "should trace hmset" do
200
- min_server_version(2.0)
201
-
202
- @redis.hset("whale", "color", "blue")
203
- @redis.hset("whale", "size", "big")
204
- @redis.hset("whale", "eyes", "green")
205
-
206
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
207
- @redis.hmset("whale", ["color", "red", "size", "very big"])
208
- end
209
-
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"
214
- end
215
-
216
- it "should trace hset" do
217
- min_server_version(2.0)
218
-
219
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
220
- @redis.hset("whale", "eyes", "green")
221
- end
222
-
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"
227
- end
228
-
229
- it "should trace hsetnx" do
230
- min_server_version(2.0)
231
-
232
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
233
- @redis.hsetnx("whale", "eyes", "green")
234
- end
235
-
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"
240
- end
241
-
242
- it "should trace hvals" do
243
- min_server_version(2.0)
244
-
245
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
246
- @redis.hvals("whale")
247
- end
248
-
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"
253
- end
254
-
255
- it "should trace hscan" do
256
- min_server_version(2.8)
257
-
258
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
259
- @redis.hscan("whale", 0)
260
- end
261
-
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"
266
- end
267
- end
268
- end
@@ -1,321 +0,0 @@
1
- # Copyright (c) 2016 SolarWinds, LLC.
2
- # All rights reserved.
3
-
4
- require 'minitest_helper'
5
-
6
- if defined?(::Redis)
7
- describe "Redis Keys" do
8
- attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
9
-
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
14
- end
15
-
16
- before do
17
- clear_all_traces
18
-
19
- @redis ||= Redis.new(:host => ENV['APPOPTICS_REDIS_SERVER'] || '127.0.0.1')
20
-
21
- @redis_version ||= @redis.info["redis_version"]
22
-
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
27
-
28
- it 'Stock Redis should be loaded, defined and ready' do
29
- defined?(::Redis).wont_match nil
30
- end
31
-
32
- it "should trace del" do
33
- @redis.setex("del_test", 60, "blah")
34
-
35
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
36
- @redis.del("del_test")
37
- end
38
-
39
- traces = get_all_traces
40
- traces.count.must_equal 4
41
- traces[2]['KVOp'].must_equal "del"
42
- traces[2]['KVKey'].must_equal "del_test"
43
- end
44
-
45
- it "should trace del of multiple keys" do
46
- @redis.setex("del_test", 60, "blah")
47
-
48
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
49
- @redis.del(["del_test", "noexist", "maybe"])
50
- end
51
-
52
- traces = get_all_traces
53
- traces.count.must_equal 4
54
- traces[2]['KVOp'].must_equal "del"
55
- traces[2].has_key?('KVKey').must_equal false
56
- end
57
-
58
- it "should trace dump" do
59
- min_server_version(2.6)
60
-
61
- @redis.setex("dump_test", 60, "blah")
62
-
63
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
64
- @redis.dump("del_test")
65
- end
66
-
67
- traces = get_all_traces
68
- traces.count.must_equal 4
69
- traces[2]['KVOp'].must_equal "dump"
70
- traces[2]['KVKey'].must_equal "del_test"
71
- end
72
-
73
- it "should trace exists" do
74
- @redis.setex("talking_heads", 60, "burning down the house")
75
-
76
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
77
- @it_exists = @redis.exists("talking_heads")
78
- end
79
-
80
- @it_exists.must_equal true
81
-
82
- traces = get_all_traces
83
- traces.count.must_equal 4
84
- traces[2]['KVOp'].must_equal "exists"
85
- traces[2]['KVKey'].must_equal "talking_heads"
86
- end
87
-
88
- it "should trace expire" do
89
- @redis.set("expire_please", "burning down the house")
90
-
91
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
92
- @redis.expire("expire_please", 120)
93
- end
94
-
95
- traces = get_all_traces
96
- traces.count.must_equal 4
97
- traces[2]['KVOp'].must_equal "expire"
98
- traces[2]['KVKey'].must_equal "expire_please"
99
- end
100
-
101
- it "should trace expireat" do
102
- @redis.set("expireat_please", "burning down the house")
103
-
104
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
105
- @redis.expireat("expireat_please", Time.now.to_i)
106
- end
107
-
108
- traces = get_all_traces
109
- traces.count.must_equal 4
110
- traces[2]['KVOp'].must_equal "expireat"
111
- traces[2]['KVKey'].must_equal "expireat_please"
112
- end
113
-
114
- it "should trace keys" do
115
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
116
- @redis.keys("del*")
117
- end
118
-
119
- traces = get_all_traces
120
- traces.count.must_equal 4
121
- traces[2]['KVOp'].must_equal "keys"
122
- traces[2]['pattern'].must_equal "del*"
123
- end
124
-
125
- it "should trace basic move" do
126
- @redis.set("piano", Time.now)
127
-
128
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
129
- @redis.move("piano", 1)
130
- end
131
-
132
- traces = get_all_traces
133
- traces.count.must_equal 4
134
- traces[2]['KVOp'].must_equal "move"
135
- traces[2]['KVKey'].must_equal "piano"
136
- traces[2]['db'].must_equal 1
137
- end
138
-
139
- it "should trace persist" do
140
- min_server_version(2.2)
141
-
142
- @redis.setex("mine", 60, "blah")
143
-
144
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
145
- @redis.persist("mine")
146
- end
147
-
148
- traces = get_all_traces
149
- traces.count.must_equal 4
150
- traces[2]['KVOp'].must_equal "persist"
151
- traces[2]['KVKey'].must_equal "mine"
152
- end
153
-
154
- it "should trace pexpire" do
155
- min_server_version(2.6)
156
-
157
- @redis.set("sand", "blah")
158
-
159
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
160
- @rv = @redis.pexpire("sand", 8000)
161
- end
162
-
163
- @rv.must_equal true
164
-
165
- traces = get_all_traces
166
- traces.count.must_equal 4
167
- traces[2]['KVOp'].must_equal "pexpire"
168
- traces[2]['KVKey'].must_equal "sand"
169
- traces[2]['milliseconds'].must_equal 8000
170
- end
171
-
172
- it "should trace pexpireat" do
173
- min_server_version(2.6)
174
-
175
- @redis.set("sand", "blah")
176
-
177
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
178
- @rv = @redis.pexpireat("sand", 8000)
179
- end
180
-
181
- @rv.must_equal true
182
-
183
- traces = get_all_traces
184
- traces.count.must_equal 4
185
- traces[2]['KVOp'].must_equal "pexpireat"
186
- traces[2]['KVKey'].must_equal "sand"
187
- traces[2]['milliseconds'].must_equal 8000
188
- end
189
-
190
- it "should trace pttl" do
191
- min_server_version(2.6)
192
-
193
- @redis.setex("sand", 120, "blah")
194
-
195
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
196
- @redis.pttl("sand")
197
- end
198
-
199
- traces = get_all_traces
200
- traces.count.must_equal 4
201
- traces[2]['KVOp'].must_equal "pttl"
202
- traces[2]['KVKey'].must_equal "sand"
203
- end
204
-
205
- it "should trace randomkey" do
206
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
207
- @redis.randomkey()
208
- end
209
-
210
- traces = get_all_traces
211
- traces.count.must_equal 4
212
- traces[2]['KVOp'].must_equal "randomkey"
213
- end
214
-
215
- it "should trace rename" do
216
- @redis.setex("sand", 120, "blah")
217
-
218
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
219
- @redis.rename("sand", "sandy")
220
- end
221
-
222
- traces = get_all_traces
223
- traces.count.must_equal 4
224
- traces[2]['KVOp'].must_equal "rename"
225
- traces[2]['KVKey'].must_equal "sand"
226
- traces[2]['newkey'].must_equal "sandy"
227
- end
228
-
229
- it "should trace renamenx" do
230
- @redis.setex("sand", 120, "blah")
231
-
232
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
233
- @redis.renamenx("sand", "sandy")
234
- end
235
-
236
- traces = get_all_traces
237
- traces.count.must_equal 4
238
- traces[2]['KVOp'].must_equal "renamenx"
239
- traces[2]['KVKey'].must_equal "sand"
240
- traces[2]['newkey'].must_equal "sandy"
241
- end
242
-
243
- it "should trace restore" do
244
- min_server_version(2.6)
245
-
246
- @redis.setex("qubit", 60, "zero")
247
- x = @redis.dump("qubit")
248
- @redis.del "blue"
249
-
250
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
251
- @redis.restore("blue", 0, x)
252
- end
253
-
254
- traces = get_all_traces
255
- traces.count.must_equal 4
256
- traces[2]['KVOp'].must_equal "restore"
257
- traces[2]['KVKey'].must_equal "blue"
258
- traces[2]['ttl'].must_equal 0
259
- end
260
-
261
- it "should trace sort" do
262
- min_server_version(2.2)
263
-
264
- @redis.rpush("penguin", "one")
265
- @redis.rpush("penguin", "two")
266
- @redis.rpush("penguin", "three")
267
- @redis.rpush("penguin", "four")
268
-
269
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
270
- @redis.sort("penguin", :order => "desc alpha", :store => "target")
271
- end
272
-
273
- traces = get_all_traces
274
- traces.count.must_equal 4
275
- traces[2]['KVOp'].must_equal "sort"
276
- traces[2]['KVKey'].must_equal "penguin"
277
- end
278
-
279
- it "should trace ttl" do
280
- min_server_version(2.6)
281
-
282
- @redis.setex("sand", 120, "blah")
283
-
284
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
285
- @redis.ttl("sand")
286
- end
287
-
288
- traces = get_all_traces
289
- traces.count.must_equal 4
290
- traces[2]['KVOp'].must_equal "ttl"
291
- traces[2]['KVKey'].must_equal "sand"
292
- end
293
-
294
- it "should trace type" do
295
- min_server_version(2.6)
296
-
297
- @redis.setex("sand", 120, "blah")
298
-
299
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
300
- @redis.type("sand")
301
- end
302
-
303
- traces = get_all_traces
304
- traces.count.must_equal 4
305
- traces[2]['KVOp'].must_equal "type"
306
- traces[2]['KVKey'].must_equal "sand"
307
- end
308
-
309
- it "should trace scan" do
310
- min_server_version(2.8)
311
-
312
- AppOpticsAPM::API.start_trace('redis_test', '', {}) do
313
- @redis.scan(0)
314
- end
315
-
316
- traces = get_all_traces
317
- traces.count.must_equal 4
318
- traces[2]['KVOp'].must_equal "scan"
319
- end
320
- end
321
- end