oboe 2.2.6 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/.gitignore +6 -1
  2. data/Appraisals +20 -0
  3. data/Gemfile +16 -20
  4. data/README.md +280 -10
  5. data/Rakefile +63 -7
  6. data/ext/oboe_metal/extconf.rb +2 -1
  7. data/ext/oboe_metal/tests/test.rb +4 -0
  8. data/gemfiles/rails2.3.gemfile +18 -0
  9. data/gemfiles/rails2.3.gemfile.lock +95 -0
  10. data/gemfiles/rails3.0.gemfile +18 -0
  11. data/gemfiles/rails3.0.gemfile.lock +142 -0
  12. data/gemfiles/rails3.1.gemfile +18 -0
  13. data/gemfiles/rails3.1.gemfile.lock +152 -0
  14. data/gemfiles/rails3.2.gemfile +18 -0
  15. data/gemfiles/rails3.2.gemfile.lock +150 -0
  16. data/init.rb +1 -1
  17. data/lib/joboe_metal.rb +52 -34
  18. data/lib/method_profiling.rb +1 -1
  19. data/lib/oboe.rb +6 -5
  20. data/lib/oboe/api.rb +1 -1
  21. data/lib/oboe/api/layerinit.rb +3 -0
  22. data/lib/oboe/api/logging.rb +1 -1
  23. data/lib/oboe/api/memcache.rb +2 -2
  24. data/lib/oboe/api/profiling.rb +6 -4
  25. data/lib/oboe/api/tracing.rb +1 -1
  26. data/lib/oboe/api/util.rb +1 -1
  27. data/lib/oboe/config.rb +29 -10
  28. data/lib/oboe/frameworks/rails.rb +6 -7
  29. data/lib/oboe/frameworks/rails/inst/action_controller.rb +1 -1
  30. data/lib/oboe/frameworks/rails/inst/action_view.rb +3 -3
  31. data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +3 -3
  32. data/lib/oboe/frameworks/rails/inst/action_view_30.rb +3 -3
  33. data/lib/oboe/frameworks/rails/inst/active_record.rb +1 -1
  34. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +1 -1
  35. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +1 -1
  36. data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +1 -1
  37. data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +1 -1
  38. data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +2 -2
  39. data/lib/oboe/inst/cassandra.rb +2 -2
  40. data/lib/oboe/inst/dalli.rb +8 -4
  41. data/lib/oboe/inst/http.rb +38 -34
  42. data/lib/oboe/inst/memcache.rb +12 -3
  43. data/lib/oboe/inst/memcached.rb +10 -5
  44. data/lib/oboe/inst/mongo.rb +19 -15
  45. data/lib/oboe/inst/moped.rb +120 -51
  46. data/lib/oboe/inst/rack.rb +14 -7
  47. data/lib/oboe/inst/resque.rb +2 -2
  48. data/lib/oboe/instrumentation.rb +3 -0
  49. data/lib/oboe/loading.rb +2 -6
  50. data/lib/oboe/logger.rb +3 -1
  51. data/lib/oboe/ruby.rb +3 -0
  52. data/lib/oboe/util.rb +2 -0
  53. data/lib/oboe/version.rb +5 -2
  54. data/lib/oboe_fu.rb +2 -0
  55. data/lib/oboe_metal.rb +23 -10
  56. data/lib/rails/generators/oboe/install_generator.rb +5 -3
  57. data/lib/rails/generators/oboe/templates/oboe_initializer.rb +24 -2
  58. data/oboe.gemspec +20 -14
  59. data/test/instrumentation/cassandra_test.rb +331 -0
  60. data/test/instrumentation/dalli_test.rb +157 -0
  61. data/test/instrumentation/http_test.rb +74 -0
  62. data/test/instrumentation/memcache_test.rb +251 -0
  63. data/test/instrumentation/memcached_test.rb +218 -0
  64. data/test/instrumentation/mongo_test.rb +406 -0
  65. data/test/instrumentation/moped_test.rb +468 -0
  66. data/test/instrumentation/rack_test.rb +55 -0
  67. data/test/instrumentation/resque_test.rb +62 -0
  68. data/test/minitest_helper.rb +113 -0
  69. data/test/support/config_test.rb +41 -0
  70. metadata +56 -35
  71. data/Gemfile.lock +0 -103
  72. data/Guardfile +0 -24
  73. data/install.rb +0 -1
  74. data/spec/instrumentation/cassandra_spec.rb +0 -18
  75. data/spec/instrumentation/dalli_spec.rb +0 -14
  76. data/spec/instrumentation/http_spec.rb +0 -14
  77. data/spec/instrumentation/memcache_spec.rb +0 -19
  78. data/spec/instrumentation/memcached_spec.rb +0 -22
  79. data/spec/instrumentation/mongo_spec.rb +0 -29
  80. data/spec/instrumentation/moped_spec.rb +0 -41
  81. data/spec/instrumentation/resque_spec.rb +0 -18
  82. data/spec/spec_helper.rb +0 -15
  83. data/spec/support/config_spec.rb +0 -27
  84. data/spec/support/oboe_spec.rb +0 -4
@@ -0,0 +1,55 @@
1
+ require 'minitest_helper'
2
+ require 'rack/test'
3
+ require 'rack/lobster'
4
+ require 'oboe/inst/rack'
5
+
6
+ Oboe::Config[:tracing_mode] = 'always'
7
+ Oboe::Config[:sample_rate] = 1e6
8
+
9
+ class RackTestApp < MiniTest::Unit::TestCase
10
+ include Rack::Test::Methods
11
+
12
+ def app
13
+ @app = Rack::Builder.new {
14
+ use Rack::CommonLogger
15
+ use Rack::ShowExceptions
16
+ use Oboe::Rack
17
+ map "/lobster" do
18
+ use Rack::Lint
19
+ run Rack::Lobster.new
20
+ end
21
+ }
22
+ end
23
+
24
+ def test_get_the_lobster
25
+ clear_all_traces
26
+
27
+ get "/lobster"
28
+
29
+ traces = get_all_traces
30
+ traces.count.must_equal 3
31
+
32
+ validate_outer_layers(traces, 'rack')
33
+
34
+ kvs = {}
35
+ kvs["Label"] = "entry"
36
+ validate_event_keys(traces[0], kvs)
37
+
38
+ kvs.clear
39
+ kvs["Label"] = "info"
40
+ kvs["Status"] = "200"
41
+ kvs["SampleRate"] = "1000000"
42
+ kvs["SampleSource"] = "1"
43
+ kvs["HTTP-Host"] = "example.org"
44
+ kvs["Port"] = "80"
45
+ kvs["Proto"] = "http"
46
+ kvs["URL"] = "/lobster"
47
+ kvs["Method"] = "GET"
48
+ kvs["ClientIP"] = "127.0.0.1"
49
+ validate_event_keys(traces[1], kvs)
50
+
51
+ assert last_response.ok?
52
+ assert last_response['X-Trace']
53
+ end
54
+ end
55
+
@@ -0,0 +1,62 @@
1
+ require 'minitest_helper'
2
+
3
+ describe Oboe::Inst::Resque do
4
+ before do
5
+ clear_all_traces
6
+
7
+ # These are standard entry/exit KVs that are passed up with all moped operations
8
+ @entry_kvs = {
9
+ 'Layer' => 'resque',
10
+ 'Label' => 'entry' }
11
+
12
+ @exit_kvs = { 'Layer' => 'resque', 'Label' => 'exit' }
13
+ end
14
+
15
+ it 'Stock Resque should be loaded, defined and ready' do
16
+ defined?(::Resque).wont_match nil
17
+ defined?(::Resque::Worker).wont_match nil
18
+ defined?(::Resque::Job).wont_match nil
19
+ end
20
+
21
+ it 'Resque should have oboe methods defined' do
22
+ [ :enqueue, :enqueue_to, :dequeue ].each do |m|
23
+ ::Resque.method_defined?("#{m}_with_oboe").must_equal true
24
+ end
25
+
26
+ ::Resque::Worker.method_defined?("perform_with_oboe").must_equal true
27
+ ::Resque::Job.method_defined?("fail_with_oboe").must_equal true
28
+ end
29
+
30
+ it "should trace enqueue" do
31
+ skip
32
+ Oboe::API.start_trace('resque-client_test', '', {}) do
33
+ Resque.enqueue(OboeResqueJob, { :generate => :activerecord, :delay => rand(5..30).to_f })
34
+ Resque.enqueue(OboeResqueJobThatFails)
35
+ Resque.dequeue(OboeResqueJob, { :generate => :moped })
36
+ end
37
+
38
+ traces = get_all_traces
39
+
40
+ traces.count.must_equal 4
41
+ validate_outer_layers(traces, 'resque-client_test')
42
+
43
+ validate_event_keys(traces[1], @entry_kvs)
44
+ validate_event_keys(traces[2], @exit_kvs)
45
+ end
46
+
47
+ it "should trace dequeue" do
48
+ skip
49
+ Oboe::API.start_trace('resque-client_test', '', {}) do
50
+ Resque.dequeue(OboeResqueJob, { :generate => :moped })
51
+ end
52
+
53
+ traces = get_all_traces
54
+
55
+ traces.count.must_equal 4
56
+ validate_outer_layers(traces, 'resque-client_test')
57
+
58
+ validate_event_keys(traces[1], @entry_kvs)
59
+ validate_event_keys(traces[2], @exit_kvs)
60
+ end
61
+ end
62
+
@@ -0,0 +1,113 @@
1
+ require "minitest/autorun"
2
+ require "minitest/reporters"
3
+
4
+ ENV["RACK_ENV"] = "test"
5
+ MiniTest::Reporters.use!
6
+
7
+ require 'rubygems'
8
+ require 'bundler'
9
+
10
+ Bundler.require(:default, :test)
11
+
12
+ # Preload memcache-client
13
+ require 'memcache'
14
+
15
+ @trace_dir = File.dirname(__FILE__) + "/../tmp/"
16
+ $trace_file = @trace_dir + "trace_output.bson"
17
+
18
+ # Create a oboe-ruby/tmp dir to store trace output
19
+ Dir.mkdir @trace_dir unless File.exists?(@trace_dir) and File.directory?(@trace_dir)
20
+
21
+ # Configure Oboe
22
+ Oboe::Config[:tracing_mode] = "always"
23
+ Oboe::Config[:sample_rate] = 1000000
24
+ Oboe::Ruby.initialize
25
+ Oboe.logger.level = Logger::DEBUG
26
+
27
+ Oboe.logger.debug "[oboe/test] Debug log output test."
28
+
29
+ ##
30
+ # clear_all_traces
31
+ #
32
+ # Truncates the trace output file to zero
33
+ #
34
+ def clear_all_traces
35
+ File.truncate($trace_file, 0)
36
+ end
37
+
38
+ ##
39
+ # get_all_traces
40
+ #
41
+ # Retrieves all traces written to the trace file
42
+ #
43
+ def get_all_traces
44
+ traces = []
45
+ f = File.open($trace_file)
46
+ until f.eof?
47
+ traces << BSON.read_bson_document(f)
48
+ end
49
+ traces
50
+ end
51
+
52
+ ##
53
+ # validate_outer_layers
54
+ #
55
+ # Validates that the KVs in kvs are present
56
+ # in event
57
+ #
58
+ def validate_outer_layers(traces, layer)
59
+ traces.first['Layer'].must_equal layer
60
+ traces.first['Label'].must_equal 'entry'
61
+ traces.last['Layer'].must_equal layer
62
+ traces.last['Label'].must_equal 'exit'
63
+ end
64
+
65
+ ##
66
+ # validate_event_keys
67
+ #
68
+ # Validates that the KVs in kvs are present
69
+ # in event
70
+ #
71
+ def validate_event_keys(event, kvs)
72
+ kvs.each do |k, v|
73
+ event.has_key?(k).must_equal true
74
+ event[k].must_equal v
75
+ end
76
+ end
77
+
78
+ ##
79
+ # layer_has_key
80
+ #
81
+ # Checks an array of trace events if a specific layer (regardless of event type)
82
+ # has he specified key
83
+ #
84
+ def layer_has_key(traces, layer, key)
85
+ has_key = false
86
+
87
+ traces.each do |t|
88
+ if t["Layer"] == layer and t.has_key?(key)
89
+ has_key = true
90
+
91
+ (t["Backtrace"].length > 0).must_equal true
92
+ end
93
+ end
94
+
95
+ has_key.must_equal true
96
+ end
97
+
98
+ ##
99
+ # layer_doesnt_have_key
100
+ #
101
+ # Checks an array of trace events to assure that a specific layer
102
+ # (regardless of event type) doesn't have the specified key
103
+ #
104
+ def layer_doesnt_have_key(traces, layer, key)
105
+ has_key = false
106
+
107
+ traces.each do |t|
108
+ has_key = true if t["Layer"] == layer and t.has_key?(key)
109
+ end
110
+
111
+ has_key.must_equal false
112
+ end
113
+
@@ -0,0 +1,41 @@
1
+ require 'minitest_helper'
2
+
3
+ describe Oboe::Config do
4
+ after do
5
+ # Set back to always trace mode
6
+ Oboe::Config[:tracing_mode] = "always"
7
+ Oboe::Config[:sample_rate] = 1000000
8
+ end
9
+
10
+ it 'should have the correct default values' do
11
+ # Reset Oboe::Config to defaults
12
+ Oboe::Config.initialize
13
+
14
+ Oboe::Config[:verbose].must_equal false
15
+ Oboe::Config[:sample_source].must_equal 2
16
+ Oboe::Config[:sample_rate].must_equal 300000
17
+ Oboe::Config[:tracing_mode].must_equal "through"
18
+ Oboe::Config[:reporter_host].must_equal "127.0.0.1"
19
+ end
20
+
21
+ it 'should have the correct instrumentation defaults' do
22
+ # Reset Oboe::Config to defaults
23
+ Oboe::Config.initialize
24
+
25
+ instrumentation = [ :cassandra, :dalli, :nethttp, :memcached, :memcache, :mongo,
26
+ :moped, :rack, :resque, :action_controller, :action_view,
27
+ :active_record ]
28
+
29
+ # Verify the number of individual instrumentations
30
+ instrumentation.count.must_equal 12
31
+
32
+ instrumentation.each do |k|
33
+ Oboe::Config[k][:enabled].must_equal true
34
+ Oboe::Config[k][:log_args].must_equal true
35
+ end
36
+
37
+ Oboe::Config[:resque][:link_workers].must_equal false
38
+ Oboe::Config[:blacklist].is_a?(Array).must_equal true
39
+ end
40
+
41
+ end
metadata CHANGED
@@ -1,21 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 3
8
9
  - 2
9
- - 6
10
- version: 2.2.6
10
+ version: 2.3.2
11
11
  platform: ruby
12
12
  authors:
13
- - Tracelytics, Inc.
13
+ - Peter Giacomo Lombardo
14
+ - Spiros Eliopoulos
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2013-09-27 00:00:00 Z
19
+ date: 2013-10-22 00:00:00 Z
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rake
@@ -32,7 +33,7 @@ dependencies:
32
33
  type: :development
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
- name: rspec
36
+ name: minitest
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
@@ -45,8 +46,22 @@ dependencies:
45
46
  version: "0"
46
47
  type: :development
47
48
  version_requirements: *id002
48
- description: The oboe gem provides AppNeta instrumentation for Ruby and Ruby frameworks.
49
- email: contact@tracelytics.com
49
+ - !ruby/object:Gem::Dependency
50
+ name: bson
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ description: The oboe gem provides TraceView instrumentation for Ruby and Ruby frameworks.
64
+ email: traceviewsupport@appneta.com
50
65
  executables: []
51
66
 
52
67
  extensions:
@@ -55,10 +70,9 @@ extra_rdoc_files:
55
70
  - LICENSE
56
71
  files:
57
72
  - .gitignore
73
+ - Appraisals
58
74
  - CHANGELOG
59
75
  - Gemfile
60
- - Gemfile.lock
61
- - Guardfile
62
76
  - LICENSE
63
77
  - README.md
64
78
  - Rakefile
@@ -70,9 +84,16 @@ files:
70
84
  - ext/oboe_metal/src/oboe.hpp
71
85
  - ext/oboe_metal/src/oboe_wrap.cxx
72
86
  - ext/oboe_metal/tests/test.rb
87
+ - gemfiles/rails2.3.gemfile
88
+ - gemfiles/rails2.3.gemfile.lock
89
+ - gemfiles/rails3.0.gemfile
90
+ - gemfiles/rails3.0.gemfile.lock
91
+ - gemfiles/rails3.1.gemfile
92
+ - gemfiles/rails3.1.gemfile.lock
93
+ - gemfiles/rails3.2.gemfile
94
+ - gemfiles/rails3.2.gemfile.lock
73
95
  - get_version.rb
74
96
  - init.rb
75
- - install.rb
76
97
  - lib/joboe_metal.rb
77
98
  - lib/method_profiling.rb
78
99
  - lib/oboe.rb
@@ -120,18 +141,18 @@ files:
120
141
  - oboe.gemspec
121
142
  - oboe_fu.gemspec
122
143
  - release.sh
123
- - spec/instrumentation/cassandra_spec.rb
124
- - spec/instrumentation/dalli_spec.rb
125
- - spec/instrumentation/http_spec.rb
126
- - spec/instrumentation/memcache_spec.rb
127
- - spec/instrumentation/memcached_spec.rb
128
- - spec/instrumentation/mongo_spec.rb
129
- - spec/instrumentation/moped_spec.rb
130
- - spec/instrumentation/resque_spec.rb
131
- - spec/spec_helper.rb
132
- - spec/support/config_spec.rb
133
- - spec/support/oboe_spec.rb
134
- homepage: http://tracelytics.com
144
+ - test/instrumentation/cassandra_test.rb
145
+ - test/instrumentation/dalli_test.rb
146
+ - test/instrumentation/http_test.rb
147
+ - test/instrumentation/memcache_test.rb
148
+ - test/instrumentation/memcached_test.rb
149
+ - test/instrumentation/mongo_test.rb
150
+ - test/instrumentation/moped_test.rb
151
+ - test/instrumentation/rack_test.rb
152
+ - test/instrumentation/resque_test.rb
153
+ - test/minitest_helper.rb
154
+ - test/support/config_test.rb
155
+ homepage: http://www.appneta.com/application-performance-management
135
156
  licenses: []
136
157
 
137
158
  post_install_message:
@@ -163,16 +184,16 @@ rubyforge_project:
163
184
  rubygems_version: 1.8.15
164
185
  signing_key:
165
186
  specification_version: 3
166
- summary: Tracelytics instrumentation gem
187
+ summary: AppNeta TraceView performance instrumentation gem for Ruby
167
188
  test_files:
168
- - spec/support/oboe_spec.rb
169
- - spec/support/config_spec.rb
170
- - spec/instrumentation/mongo_spec.rb
171
- - spec/instrumentation/moped_spec.rb
172
- - spec/instrumentation/cassandra_spec.rb
173
- - spec/instrumentation/http_spec.rb
174
- - spec/instrumentation/resque_spec.rb
175
- - spec/instrumentation/dalli_spec.rb
176
- - spec/instrumentation/memcache_spec.rb
177
- - spec/instrumentation/memcached_spec.rb
178
- - spec/spec_helper.rb
189
+ - test/minitest_helper.rb
190
+ - test/support/config_test.rb
191
+ - test/instrumentation/memcached_test.rb
192
+ - test/instrumentation/memcache_test.rb
193
+ - test/instrumentation/dalli_test.rb
194
+ - test/instrumentation/http_test.rb
195
+ - test/instrumentation/cassandra_test.rb
196
+ - test/instrumentation/resque_test.rb
197
+ - test/instrumentation/rack_test.rb
198
+ - test/instrumentation/moped_test.rb
199
+ - test/instrumentation/mongo_test.rb
@@ -1,103 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- oboe (2.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- bson (1.8.2)
10
- bson_ext (1.8.2)
11
- bson (~> 1.8.2)
12
- cassandra (0.17.0)
13
- json
14
- rake
15
- simple_uuid (~> 0.2.0)
16
- thrift_client (>= 0.7.0, < 0.9)
17
- coderay (1.0.9)
18
- dalli (2.6.2)
19
- diff-lcs (1.1.3)
20
- ffi (1.4.0)
21
- guard (1.6.2)
22
- listen (>= 0.6.0)
23
- lumberjack (>= 1.0.2)
24
- pry (>= 0.9.10)
25
- terminal-table (>= 1.4.3)
26
- thor (>= 0.14.6)
27
- guard-rspec (2.4.1)
28
- guard (>= 1.1)
29
- rspec (~> 2.11)
30
- json (1.7.7)
31
- listen (0.7.3)
32
- lumberjack (1.0.2)
33
- memcache-client (1.8.5)
34
- memcached (1.5.0)
35
- method_source (0.8.1)
36
- mongo (1.8.2)
37
- bson (~> 1.8.2)
38
- moped (1.4.2)
39
- multi_json (1.6.1)
40
- pry (0.9.12)
41
- coderay (~> 1.0.5)
42
- method_source (~> 0.8)
43
- slop (~> 3.4)
44
- rack (1.4.5)
45
- rack-protection (1.3.2)
46
- rack
47
- rake (10.0.3)
48
- rb-fchange (0.0.6)
49
- ffi
50
- rb-fsevent (0.9.3)
51
- rb-inotify (0.9.0)
52
- ffi (>= 0.5.0)
53
- redis (3.0.2)
54
- redis-namespace (1.2.1)
55
- redis (~> 3.0.0)
56
- resque (1.23.0)
57
- multi_json (~> 1.0)
58
- redis-namespace (~> 1.0)
59
- sinatra (>= 0.9.2)
60
- vegas (~> 0.1.2)
61
- rspec (2.11.0)
62
- rspec-core (~> 2.11.0)
63
- rspec-expectations (~> 2.11.0)
64
- rspec-mocks (~> 2.11.0)
65
- rspec-core (2.11.1)
66
- rspec-expectations (2.11.3)
67
- diff-lcs (~> 1.1.3)
68
- rspec-mocks (2.11.2)
69
- simple_uuid (0.2.0)
70
- sinatra (1.3.4)
71
- rack (~> 1.4)
72
- rack-protection (~> 1.3)
73
- tilt (~> 1.3, >= 1.3.3)
74
- slop (3.4.3)
75
- terminal-table (1.4.5)
76
- thor (0.17.0)
77
- thrift (0.8.0)
78
- thrift_client (0.8.3)
79
- thrift (~> 0.8.0)
80
- tilt (1.3.3)
81
- vegas (0.1.11)
82
- rack (>= 1.0.0)
83
-
84
- PLATFORMS
85
- ruby
86
-
87
- DEPENDENCIES
88
- bson_ext
89
- cassandra
90
- dalli
91
- guard
92
- guard-rspec
93
- memcache-client
94
- memcached
95
- mongo
96
- moped
97
- oboe!
98
- rake
99
- rb-fchange
100
- rb-fsevent
101
- rb-inotify
102
- resque
103
- rspec