oboe 2.6.6.1 → 2.6.7.1

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -0
  3. data/Appraisals +6 -16
  4. data/CHANGELOG.md +30 -14
  5. data/Gemfile +4 -3
  6. data/Gemfile.lock +20 -25
  7. data/Rakefile +5 -1
  8. data/ext/oboe_metal/extconf.rb +2 -2
  9. data/gemfiles/mongo.gemfile +33 -0
  10. data/gemfiles/moped.gemfile +33 -0
  11. data/lib/base.rb +28 -10
  12. data/lib/joboe_metal.rb +12 -34
  13. data/lib/method_profiling.rb +3 -3
  14. data/lib/oboe/api/layerinit.rb +14 -14
  15. data/lib/oboe/api/logging.rb +11 -11
  16. data/lib/oboe/api/profiling.rb +7 -6
  17. data/lib/oboe/api/tracing.rb +3 -3
  18. data/lib/oboe/api/util.rb +4 -4
  19. data/lib/oboe/config.rb +7 -7
  20. data/lib/oboe/frameworks/padrino.rb +2 -2
  21. data/lib/oboe/frameworks/rails.rb +11 -11
  22. data/lib/oboe/frameworks/rails/inst/action_controller.rb +4 -4
  23. data/lib/oboe/frameworks/rails/inst/action_view.rb +2 -2
  24. data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +1 -1
  25. data/lib/oboe/frameworks/rails/inst/action_view_30.rb +1 -1
  26. data/lib/oboe/frameworks/rails/inst/active_record.rb +1 -1
  27. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +3 -3
  28. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +2 -2
  29. data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +1 -1
  30. data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +8 -8
  31. data/lib/oboe/frameworks/sinatra.rb +33 -3
  32. data/lib/oboe/frameworks/sinatra/templates.rb +2 -2
  33. data/lib/oboe/inst/cassandra.rb +19 -19
  34. data/lib/oboe/inst/dalli.rb +7 -7
  35. data/lib/oboe/inst/http.rb +5 -5
  36. data/lib/oboe/inst/memcache.rb +14 -14
  37. data/lib/oboe/inst/memcached.rb +8 -8
  38. data/lib/oboe/inst/mongo.rb +2 -2
  39. data/lib/oboe/inst/moped.rb +29 -29
  40. data/lib/oboe/inst/rack.rb +3 -3
  41. data/lib/oboe/inst/redis.rb +24 -24
  42. data/lib/oboe/inst/resque.rb +4 -4
  43. data/lib/oboe/loading.rb +6 -6
  44. data/lib/oboe/logger.rb +4 -4
  45. data/lib/oboe/version.rb +1 -1
  46. data/lib/oboe_metal.rb +11 -39
  47. data/test/frameworks/apps/grape_simple.rb +1 -1
  48. data/test/frameworks/apps/sinatra_simple.rb +1 -1
  49. data/test/frameworks/padrino_test.rb +3 -3
  50. data/test/frameworks/sinatra_test.rb +3 -3
  51. data/test/instrumentation/cassandra_test.rb +45 -45
  52. data/test/instrumentation/http_test.rb +6 -6
  53. data/test/instrumentation/mongo_test.rb +347 -345
  54. data/test/instrumentation/moped_test.rb +40 -40
  55. data/test/instrumentation/redis_hashes_test.rb +20 -20
  56. data/test/instrumentation/redis_keys_test.rb +19 -19
  57. data/test/instrumentation/redis_lists_test.rb +22 -22
  58. data/test/instrumentation/redis_misc_test.rb +14 -14
  59. data/test/instrumentation/redis_sets_test.rb +20 -20
  60. data/test/instrumentation/redis_sortedsets_test.rb +25 -25
  61. data/test/instrumentation/redis_strings_test.rb +27 -27
  62. data/test/instrumentation/resque_test.rb +7 -7
  63. data/test/minitest_helper.rb +18 -6
  64. data/test/profiling/method_test.rb +24 -24
  65. data/test/support/liboboe_settings_test.rb +3 -3
  66. data/test/support/xtrace_test.rb +2 -2
  67. metadata +26 -32
  68. data/gemfiles/rails2.3.gemfile +0 -18
  69. data/gemfiles/rails2.3.gemfile.lock +0 -95
  70. data/gemfiles/rails3.0.gemfile +0 -18
  71. data/gemfiles/rails3.0.gemfile.lock +0 -142
  72. data/gemfiles/rails3.1.gemfile +0 -18
  73. data/gemfiles/rails3.1.gemfile.lock +0 -152
  74. data/gemfiles/rails3.2.gemfile +0 -18
  75. data/gemfiles/rails3.2.gemfile.lock +0 -150
@@ -1,18 +1,18 @@
1
1
  require 'minitest_helper'
2
2
  require "redis"
3
-
3
+
4
4
  describe Oboe::Inst::Redis, :strings do
5
5
  attr_reader :entry_kvs, :exit_kvs, :redis, :redis_version
6
6
 
7
7
  def min_server_version(version)
8
8
  unless Gem::Version.new(@redis_version) >= Gem::Version.new(version.to_s)
9
- skip "supported only on redis-server #{version} or greater"
9
+ skip "supported only on redis-server #{version} or greater"
10
10
  end
11
11
  end
12
12
 
13
13
  before do
14
- clear_all_traces
15
-
14
+ clear_all_traces
15
+
16
16
  @redis ||= Redis.new
17
17
 
18
18
  @redis_version ||= @redis.info["redis_version"]
@@ -21,7 +21,7 @@ describe Oboe::Inst::Redis, :strings do
21
21
  @entry_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'entry' }
22
22
  @exit_kvs ||= { 'Layer' => 'redis_test', 'Label' => 'exit' }
23
23
  end
24
-
24
+
25
25
  it "should trace append" do
26
26
  @redis.set("yourkey", "test")
27
27
 
@@ -34,9 +34,9 @@ describe Oboe::Inst::Redis, :strings do
34
34
  traces[2]['KVOp'].must_equal "append"
35
35
  traces[2]['KVKey'].must_equal "yourkey"
36
36
  end
37
-
37
+
38
38
  it "should trace bitcount (>=2.6)" do
39
-
39
+
40
40
  min_server_version("2.6")
41
41
 
42
42
  Oboe::API.start_trace('redis_test', '', {}) do
@@ -49,9 +49,9 @@ describe Oboe::Inst::Redis, :strings do
49
49
  traces[2]['start'].must_equal "0"
50
50
  traces[2]['stop'].must_equal "-1"
51
51
  end
52
-
52
+
53
53
  it "should trace bitop (>=2.6)" do
54
-
54
+
55
55
  min_server_version("2.6")
56
56
 
57
57
  Oboe::API.start_trace('redis_test', '', {}) do
@@ -64,7 +64,7 @@ describe Oboe::Inst::Redis, :strings do
64
64
  traces[2]['operation'].must_equal "not"
65
65
  traces[2]['destkey'].must_equal "bitopkey"
66
66
  end
67
-
67
+
68
68
  it "should trace decr" do
69
69
  @redis.setex("decr", 60, 0)
70
70
 
@@ -77,7 +77,7 @@ describe Oboe::Inst::Redis, :strings do
77
77
  traces[2]['KVOp'].must_equal "decr"
78
78
  traces[2]['KVKey'].must_equal "decr"
79
79
  end
80
-
80
+
81
81
  it "should trace decrby" do
82
82
  @redis.setex("decr", 60, 0)
83
83
 
@@ -91,7 +91,7 @@ describe Oboe::Inst::Redis, :strings do
91
91
  traces[2]['KVKey'].must_equal "decr"
92
92
  traces[2]['decrement'].must_equal "1"
93
93
  end
94
-
94
+
95
95
  it "should trace get" do
96
96
  @redis.setex("diwore", 60, "okokok")
97
97
 
@@ -106,10 +106,10 @@ describe Oboe::Inst::Redis, :strings do
106
106
  traces[2]['KVOp'].must_equal "get"
107
107
  traces[2]['KVKey'].must_equal "diwore"
108
108
  end
109
-
109
+
110
110
  it "should trace getbit" do
111
111
  min_server_version(2.2)
112
-
112
+
113
113
  @redis.setex("diwore", 60, "okokok")
114
114
 
115
115
  Oboe::API.start_trace('redis_test', '', {}) do
@@ -122,7 +122,7 @@ describe Oboe::Inst::Redis, :strings do
122
122
  traces[2]['KVKey'].must_equal "diwore"
123
123
  traces[2]['offset'].must_equal "3"
124
124
  end
125
-
125
+
126
126
  it "should trace getrange" do
127
127
  min_server_version(2.2)
128
128
 
@@ -137,7 +137,7 @@ describe Oboe::Inst::Redis, :strings do
137
137
  traces[2]['start'].must_equal "0"
138
138
  traces[2]['end'].must_equal "3"
139
139
  end
140
-
140
+
141
141
  it "should trace getset" do
142
142
  min_server_version(2.2)
143
143
 
@@ -151,7 +151,7 @@ describe Oboe::Inst::Redis, :strings do
151
151
  traces[2]['KVKey'].must_equal "dollar"
152
152
  traces[2]['value'].must_equal "0"
153
153
  end
154
-
154
+
155
155
  it "should trace incr" do
156
156
  @redis.setex("dotcom", 60, 0)
157
157
 
@@ -178,7 +178,7 @@ describe Oboe::Inst::Redis, :strings do
178
178
  traces[2]['KVKey'].must_equal "incr"
179
179
  traces[2]['increment'].must_equal "1"
180
180
  end
181
-
181
+
182
182
  it "should trace incrbyfloat" do
183
183
  min_server_version(2.6)
184
184
 
@@ -194,7 +194,7 @@ describe Oboe::Inst::Redis, :strings do
194
194
  traces[2]['KVKey'].must_equal "incrfloat"
195
195
  traces[2]['increment'].must_equal "1.01"
196
196
  end
197
-
197
+
198
198
  it "should trace mget" do
199
199
  @redis.setex("france", 60, "ok")
200
200
  @redis.setex("denmark", 60, "ok")
@@ -214,7 +214,7 @@ describe Oboe::Inst::Redis, :strings do
214
214
  traces[4]['KVKeyCount'].must_equal "1"
215
215
  traces[4]['KVHitCount'].must_equal "1"
216
216
  end
217
-
217
+
218
218
  it "should trace mset" do
219
219
  Oboe::API.start_trace('redis_test', '', {}) do
220
220
  @redis.mset(["one", 1, "two", 2, "three", 3])
@@ -228,7 +228,7 @@ describe Oboe::Inst::Redis, :strings do
228
228
  traces[4]['KVOp'].must_equal "mset"
229
229
  traces[4]['KVKeyCount'].must_equal "1"
230
230
  end
231
-
231
+
232
232
  it "should trace msetnx" do
233
233
  Oboe::API.start_trace('redis_test', '', {}) do
234
234
  @redis.msetnx(["one", 1, "two", 2, "three", 3])
@@ -238,9 +238,9 @@ describe Oboe::Inst::Redis, :strings do
238
238
  traces.count.must_equal 4
239
239
  traces[2]['KVOp'].must_equal "msetnx"
240
240
  end
241
-
241
+
242
242
  it "should trace psetex (>= v2.6)" do
243
-
243
+
244
244
  Oboe::API.start_trace('redis_test', '', {}) do
245
245
  @redis.psetex("one", 60, "hello")
246
246
  end
@@ -251,7 +251,7 @@ describe Oboe::Inst::Redis, :strings do
251
251
  traces[2]['KVKey'].must_equal "one"
252
252
  traces[2]['ttl'].must_equal "60"
253
253
  end
254
-
254
+
255
255
  it "should trace basic set" do
256
256
  Oboe::API.start_trace('redis_test', '', {}) do
257
257
  @redis.set("one", "hello")
@@ -262,7 +262,7 @@ describe Oboe::Inst::Redis, :strings do
262
262
  traces[2]['KVOp'].must_equal "set"
263
263
  traces[2]['KVKey'].must_equal "one"
264
264
  end
265
-
265
+
266
266
  it "should trace setbit" do
267
267
  min_server_version(2.2)
268
268
 
@@ -276,7 +276,7 @@ describe Oboe::Inst::Redis, :strings do
276
276
  traces[2]['KVKey'].must_equal "yourkey"
277
277
  traces[2]['offset'].must_equal "3"
278
278
  end
279
-
279
+
280
280
  it "should trace setex" do
281
281
  Oboe::API.start_trace('redis_test', '', {}) do
282
282
  @redis.setex("one", 60, "hello")
@@ -299,7 +299,7 @@ describe Oboe::Inst::Redis, :strings do
299
299
  traces[2]['KVOp'].must_equal "setnx"
300
300
  traces[2]['KVKey'].must_equal "one"
301
301
  end
302
-
302
+
303
303
  it "should trace setrange" do
304
304
  min_server_version(2.2)
305
305
 
@@ -2,7 +2,7 @@ require 'minitest_helper'
2
2
 
3
3
  describe Oboe::Inst::Resque do
4
4
  before do
5
- clear_all_traces
5
+ clear_all_traces
6
6
 
7
7
  # These are standard entry/exit KVs that are passed up with all moped operations
8
8
  @entry_kvs = {
@@ -13,7 +13,7 @@ describe Oboe::Inst::Resque do
13
13
  end
14
14
 
15
15
  it 'Stock Resque should be loaded, defined and ready' do
16
- defined?(::Resque).wont_match nil
16
+ defined?(::Resque).wont_match nil
17
17
  defined?(::Resque::Worker).wont_match nil
18
18
  defined?(::Resque::Job).wont_match nil
19
19
  end
@@ -34,24 +34,24 @@ describe Oboe::Inst::Resque do
34
34
  Resque.enqueue(OboeResqueJobThatFails)
35
35
  Resque.dequeue(OboeResqueJob, { :generate => :moped })
36
36
  end
37
-
37
+
38
38
  traces = get_all_traces
39
-
39
+
40
40
  traces.count.must_equal 4
41
41
  validate_outer_layers(traces, 'resque-client_test')
42
42
 
43
43
  validate_event_keys(traces[1], @entry_kvs)
44
44
  validate_event_keys(traces[2], @exit_kvs)
45
45
  end
46
-
46
+
47
47
  it "should trace dequeue" do
48
48
  skip
49
49
  Oboe::API.start_trace('resque-client_test', '', {}) do
50
50
  Resque.dequeue(OboeResqueJob, { :generate => :moped })
51
51
  end
52
-
52
+
53
53
  traces = get_all_traces
54
-
54
+
55
55
  traces.count.must_equal 4
56
56
  validate_outer_layers(traces, 'resque-client_test')
57
57
 
@@ -3,7 +3,7 @@ require "minitest/reporters"
3
3
 
4
4
  ENV["RACK_ENV"] = "test"
5
5
 
6
- # FIXME: Temp hack to fix padrino-core calling RUBY_ENGINE when it's
6
+ # FIXME: Temp hack to fix padrino-core calling RUBY_ENGINE when it's
7
7
  # not defined under Ruby 1.8.7 and 1.9.3
8
8
  RUBY_ENGINE = "ruby" unless defined?(RUBY_ENGINE)
9
9
 
@@ -46,11 +46,23 @@ end
46
46
  # Retrieves all traces written to the trace file
47
47
  #
48
48
  def get_all_traces
49
+ io = File.open($trace_file, "r")
50
+ contents = io.readlines(nil)
51
+
52
+ return contents if contents.empty?
53
+
54
+ s = StringIO.new(contents[0])
55
+
49
56
  traces = []
50
- f = File.open($trace_file)
51
- until f.eof?
52
- traces << BSON.read_bson_document(f)
57
+
58
+ until s.eof?
59
+ if ::BSON.respond_to? :read_bson_document
60
+ traces << BSON.read_bson_document(s)
61
+ else
62
+ traces << BSON::Document.from_bson(s)
63
+ end
53
64
  end
65
+
54
66
  traces
55
67
  end
56
68
 
@@ -103,7 +115,7 @@ end
103
115
  ##
104
116
  # layer_doesnt_have_key
105
117
  #
106
- # Checks an array of trace events to assure that a specific layer
118
+ # Checks an array of trace events to assure that a specific layer
107
119
  # (regardless of event type) doesn't have the specified key
108
120
  #
109
121
  def layer_doesnt_have_key(traces, layer, key)
@@ -118,7 +130,7 @@ end
118
130
 
119
131
  ##
120
132
  # Sinatra and Padrino Related Helpers
121
- #
133
+ #
122
134
  # Taken from padrino-core gem
123
135
  #
124
136
 
@@ -2,18 +2,18 @@ require 'minitest_helper'
2
2
 
3
3
  describe OboeMethodProfiling do
4
4
  before do
5
- clear_all_traces
5
+ clear_all_traces
6
6
  # Conditionally Undefine TestWorker
7
7
  # http://stackoverflow.com/questions/11503558/how-to-undefine-class-in-ruby
8
8
  Object.send(:remove_const, :TestWorker) if defined?(TestWorker)
9
9
  end
10
-
10
+
11
11
  it 'should be loaded, defined and ready' do
12
- defined?(::OboeMethodProfiling).wont_match nil
12
+ defined?(::OboeMethodProfiling).wont_match nil
13
13
  end
14
14
 
15
15
  it 'should trace Class methods' do
16
- class TestWorker
16
+ class TestWorker
17
17
  def self.do_work
18
18
  sleep 1
19
19
  end
@@ -31,11 +31,10 @@ describe OboeMethodProfiling do
31
31
 
32
32
  traces = get_all_traces
33
33
  traces.count.must_equal 4
34
-
34
+
35
35
  validate_outer_layers(traces, 'method_profiling')
36
36
 
37
37
  kvs = {}
38
- kvs["Layer"] = ""
39
38
  kvs["Label"] = 'profile_entry'
40
39
  kvs["Language"] = "ruby"
41
40
  kvs["ProfileName"] = "do_work"
@@ -44,20 +43,21 @@ describe OboeMethodProfiling do
44
43
 
45
44
  validate_event_keys(traces[1], kvs)
46
45
 
46
+ traces[1].has_key?("Layer").must_equal false
47
47
  traces[1].has_key?("File").must_equal true
48
48
  traces[1].has_key?("LineNumber").must_equal true
49
49
 
50
50
  kvs.clear
51
- kvs["Layer"] = ""
52
51
  kvs["Label"] = "profile_exit"
53
52
  kvs["Language"] = "ruby"
54
53
  kvs["ProfileName"] = "do_work"
55
-
54
+
56
55
  validate_event_keys(traces[2], kvs)
56
+ traces[2].has_key?("Layer").must_equal false
57
57
  end
58
-
58
+
59
59
  it 'should trace Instance methods' do
60
- class TestWorker
60
+ class TestWorker
61
61
  def do_work
62
62
  sleep 1
63
63
  end
@@ -74,11 +74,10 @@ describe OboeMethodProfiling do
74
74
 
75
75
  traces = get_all_traces
76
76
  traces.count.must_equal 4
77
-
77
+
78
78
  validate_outer_layers(traces, 'method_profiling')
79
79
 
80
80
  kvs = {}
81
- kvs["Layer"] = ""
82
81
  kvs["Label"] = 'profile_entry'
83
82
  kvs["Language"] = "ruby"
84
83
  kvs["ProfileName"] = "do_work"
@@ -87,20 +86,21 @@ describe OboeMethodProfiling do
87
86
 
88
87
  validate_event_keys(traces[1], kvs)
89
88
 
89
+ traces[1].has_key?("Layer").must_equal false
90
90
  traces[1].has_key?("File").must_equal true
91
91
  traces[1].has_key?("LineNumber").must_equal true
92
92
 
93
93
  kvs.clear
94
- kvs["Layer"] = ""
95
94
  kvs["Label"] = "profile_exit"
96
95
  kvs["Language"] = "ruby"
97
96
  kvs["ProfileName"] = "do_work"
98
-
97
+
99
98
  validate_event_keys(traces[2], kvs)
99
+ traces[2].has_key?("Layer").must_equal false
100
100
  end
101
-
101
+
102
102
  it 'should trace Module class methods' do
103
- module TestWorker
103
+ module TestWorker
104
104
  def self.do_work
105
105
  sleep 1
106
106
  end
@@ -121,7 +121,6 @@ describe OboeMethodProfiling do
121
121
  validate_outer_layers(traces, 'method_profiling')
122
122
 
123
123
  kvs = {}
124
- kvs["Layer"] = ""
125
124
  kvs["Label"] = 'profile_entry'
126
125
  kvs["Language"] = "ruby"
127
126
  kvs["ProfileName"] = "do_work"
@@ -130,20 +129,21 @@ describe OboeMethodProfiling do
130
129
 
131
130
  validate_event_keys(traces[1], kvs)
132
131
 
132
+ traces[1].has_key?("Layer").must_equal false
133
133
  traces[1].has_key?("File").must_equal true
134
134
  traces[1].has_key?("LineNumber").must_equal true
135
135
 
136
136
  kvs.clear
137
- kvs["Layer"] = ""
138
137
  kvs["Label"] = "profile_exit"
139
138
  kvs["Language"] = "ruby"
140
139
  kvs["ProfileName"] = "do_work"
141
-
140
+
142
141
  validate_event_keys(traces[2], kvs)
142
+ traces[2].has_key?("Layer").must_equal false
143
143
  end
144
-
144
+
145
145
  it 'should not store arguments and return value by default' do
146
- class TestWorker
146
+ class TestWorker
147
147
  def self.do_work(s, i, a, h)
148
148
  sleep 1
149
149
  return "the zebra is loose"
@@ -167,9 +167,9 @@ describe OboeMethodProfiling do
167
167
  traces[1].has_key?("Args").must_equal false
168
168
  traces[2].has_key?("ReturnValue").must_equal false
169
169
  end
170
-
170
+
171
171
  it 'should store arguments and return value when asked' do
172
- class TestWorker
172
+ class TestWorker
173
173
  def self.do_work(s, i, a, h)
174
174
  sleep 1
175
175
  return "the zebra is loose"
@@ -191,7 +191,7 @@ describe OboeMethodProfiling do
191
191
 
192
192
  traces[1].has_key?("Args").must_equal true
193
193
  traces[1]["Args"].must_equal "\"String Argument\"\n203984\n[\"1\", \"2\", 3]\n{:color=>:black}\n"
194
-
194
+
195
195
  traces[2].has_key?("ReturnValue").must_equal true
196
196
  traces[2]["ReturnValue"].must_equal "\"the zebra is loose\"\n"
197
197
  end