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,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake"
6
+ gem "appraisal"
7
+ gem "dalli"
8
+ gem "memcache-client"
9
+ gem "memcached"
10
+ gem "cassandra"
11
+ gem "mongo"
12
+ gem "bson_ext"
13
+ gem "moped"
14
+ gem "resque"
15
+ gem "rails", "~> 3.2.13"
16
+ gem "oboe", :path=>"../"
17
+
18
+ gemspec :name=>"oboe", :path=>"../"
@@ -0,0 +1,150 @@
1
+ PATH
2
+ remote: /home/pglombardo/Projects/oboe-ruby
3
+ specs:
4
+ oboe (2.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (3.2.13)
10
+ actionpack (= 3.2.13)
11
+ mail (~> 2.5.3)
12
+ actionpack (3.2.13)
13
+ activemodel (= 3.2.13)
14
+ activesupport (= 3.2.13)
15
+ builder (~> 3.0.0)
16
+ erubis (~> 2.7.0)
17
+ journey (~> 1.0.4)
18
+ rack (~> 1.4.5)
19
+ rack-cache (~> 1.2)
20
+ rack-test (~> 0.6.1)
21
+ sprockets (~> 2.2.1)
22
+ activemodel (3.2.13)
23
+ activesupport (= 3.2.13)
24
+ builder (~> 3.0.0)
25
+ activerecord (3.2.13)
26
+ activemodel (= 3.2.13)
27
+ activesupport (= 3.2.13)
28
+ arel (~> 3.0.2)
29
+ tzinfo (~> 0.3.29)
30
+ activeresource (3.2.13)
31
+ activemodel (= 3.2.13)
32
+ activesupport (= 3.2.13)
33
+ activesupport (3.2.13)
34
+ i18n (= 0.6.1)
35
+ multi_json (~> 1.0)
36
+ appraisal (0.5.2)
37
+ bundler
38
+ rake
39
+ arel (3.0.2)
40
+ bson (1.9.0)
41
+ bson_ext (1.9.0)
42
+ bson (~> 1.9.0)
43
+ builder (3.0.4)
44
+ cassandra (0.18.0)
45
+ json
46
+ rake
47
+ simple_uuid (~> 0.2.0)
48
+ thrift_client (>= 0.7.0, < 0.9)
49
+ dalli (2.6.4)
50
+ diff-lcs (1.2.4)
51
+ erubis (2.7.0)
52
+ hike (1.2.3)
53
+ i18n (0.6.1)
54
+ journey (1.0.4)
55
+ json (1.8.0)
56
+ mail (2.5.4)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ memcache-client (1.8.5)
60
+ memcached (1.6.1)
61
+ mime-types (1.23)
62
+ mongo (1.9.0)
63
+ bson (~> 1.9.0)
64
+ mono_logger (1.1.0)
65
+ moped (1.5.0)
66
+ multi_json (1.7.7)
67
+ polyglot (0.3.3)
68
+ rack (1.4.5)
69
+ rack-cache (1.2)
70
+ rack (>= 0.4)
71
+ rack-protection (1.5.0)
72
+ rack
73
+ rack-ssl (1.3.3)
74
+ rack
75
+ rack-test (0.6.2)
76
+ rack (>= 1.0)
77
+ rails (3.2.13)
78
+ actionmailer (= 3.2.13)
79
+ actionpack (= 3.2.13)
80
+ activerecord (= 3.2.13)
81
+ activeresource (= 3.2.13)
82
+ activesupport (= 3.2.13)
83
+ bundler (~> 1.0)
84
+ railties (= 3.2.13)
85
+ railties (3.2.13)
86
+ actionpack (= 3.2.13)
87
+ activesupport (= 3.2.13)
88
+ rack-ssl (~> 1.3.2)
89
+ rake (>= 0.8.7)
90
+ rdoc (~> 3.4)
91
+ thor (>= 0.14.6, < 2.0)
92
+ rake (10.1.0)
93
+ rdoc (3.12.2)
94
+ json (~> 1.4)
95
+ redis (3.0.4)
96
+ redis-namespace (1.3.0)
97
+ redis (~> 3.0.0)
98
+ resque (1.24.1)
99
+ mono_logger (~> 1.0)
100
+ multi_json (~> 1.0)
101
+ redis-namespace (~> 1.2)
102
+ sinatra (>= 0.9.2)
103
+ vegas (~> 0.1.2)
104
+ rspec (2.13.0)
105
+ rspec-core (~> 2.13.0)
106
+ rspec-expectations (~> 2.13.0)
107
+ rspec-mocks (~> 2.13.0)
108
+ rspec-core (2.13.1)
109
+ rspec-expectations (2.13.0)
110
+ diff-lcs (>= 1.1.3, < 2.0)
111
+ rspec-mocks (2.13.1)
112
+ simple_uuid (0.2.0)
113
+ sinatra (1.4.3)
114
+ rack (~> 1.4)
115
+ rack-protection (~> 1.4)
116
+ tilt (~> 1.3, >= 1.3.4)
117
+ sprockets (2.2.2)
118
+ hike (~> 1.2)
119
+ multi_json (~> 1.0)
120
+ rack (~> 1.0)
121
+ tilt (~> 1.1, != 1.3.0)
122
+ thor (0.18.1)
123
+ thrift (0.8.0)
124
+ thrift_client (0.8.4)
125
+ thrift (~> 0.8.0)
126
+ tilt (1.4.1)
127
+ treetop (1.4.14)
128
+ polyglot
129
+ polyglot (>= 0.3.1)
130
+ tzinfo (0.3.37)
131
+ vegas (0.1.11)
132
+ rack (>= 1.0.0)
133
+
134
+ PLATFORMS
135
+ ruby
136
+
137
+ DEPENDENCIES
138
+ appraisal
139
+ bson_ext
140
+ cassandra
141
+ dalli
142
+ memcache-client
143
+ memcached
144
+ mongo
145
+ moped
146
+ oboe!
147
+ rails (~> 3.2.13)
148
+ rake
149
+ resque
150
+ rspec
data/init.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  require 'oboe'
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe_metal
@@ -12,7 +12,7 @@ module Oboe_metal
12
12
  import 'com.tracelytics.joboe.Event'
13
13
 
14
14
  class Context
15
- def self.log(layer, label, options = {}, with_backtrace = true)
15
+ def self.log(layer, label, options = {}, with_backtrace = false)
16
16
  evt = Oboe::Context.createEvent()
17
17
  evt.addInfo("Layer", layer.to_s)
18
18
  evt.addInfo("Label", label.to_s)
@@ -70,6 +70,27 @@ module Oboe_metal
70
70
  end
71
71
 
72
72
  module Reporter
73
+ ##
74
+ # Initialize the Oboe Context, reporter and report the initialization
75
+ #
76
+ def self.start
77
+ begin
78
+ Oboe_metal::Context.init()
79
+
80
+ if ENV['RACK_ENV'] == "test"
81
+ Oboe.reporter = Oboe::FileReporter.new("./tmp/trace_output.bson")
82
+ else
83
+ Oboe.reporter = Oboe::UdpReporter.new(Oboe::Config[:reporter_host])
84
+ end
85
+
86
+ Oboe::API.report_init('ruby') unless ["development", "test"].include? ENV['RACK_ENV']
87
+
88
+ rescue Exception => e
89
+ $stderr.puts e.message
90
+ raise
91
+ end
92
+ end
93
+
73
94
  def self.sendReport(evt)
74
95
  evt.report
75
96
  end
@@ -79,42 +100,39 @@ end
79
100
  module Oboe
80
101
  include Oboe_metal
81
102
 
82
- def self.always?
83
- Oboe::Config[:tracing_mode].to_s == "always"
84
- end
85
-
86
- def self.log(layer, label, options = {})
87
- Context.log(layer, label, options = options)
88
- end
103
+ class << self
104
+ attr_accessor :reporter
89
105
 
90
- def self.never?
91
- Oboe::Config[:tracing_mode].to_s == "never"
92
- end
93
-
94
- def self.passthrough?
95
- ["always", "through"].include?(Oboe::Config[:tracing_mode])
96
- end
106
+ def always?
107
+ Oboe::Config[:tracing_mode].to_s == "always"
108
+ end
97
109
 
98
- def self.sample?(opts = {})
99
- # Assure defaults since SWIG enforces Strings
100
- opts[:layer] ||= ''
101
- opts[:xtrace] ||= ''
102
- opts['X-TV-Meta'] ||= ''
103
- Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
104
- end
105
-
106
- def self.through?
107
- Oboe::Config[:tracing_mode] == "through"
108
- end
110
+ def log(layer, label, options = {})
111
+ Context.log(layer, label, options = options)
112
+ end
109
113
 
110
- def self.tracing?
111
- Oboe::Context.isValid and not Oboe.never?
112
- end
114
+ def never?
115
+ Oboe::Config[:tracing_mode].to_s == "never"
116
+ end
113
117
 
114
- def self.reporter
115
- if !@reporter
116
- @reporter = Oboe::UdpReporter.new(Oboe::Config[:reporter_host])
118
+ def passthrough?
119
+ ["always", "through"].include?(Oboe::Config[:tracing_mode])
120
+ end
121
+
122
+ def sample?(opts = {})
123
+ # Assure defaults since SWIG enforces Strings
124
+ opts[:layer] ||= ''
125
+ opts[:xtrace] ||= ''
126
+ opts['X-TV-Meta'] ||= ''
127
+ Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
128
+ end
129
+
130
+ def through?
131
+ Oboe::Config[:tracing_mode] == "through"
132
+ end
133
+
134
+ def tracing?
135
+ Oboe::Context.isValid and not Oboe.never?
117
136
  end
118
- return @reporter
119
137
  end
120
138
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module OboeMethodProfiling
@@ -1,9 +1,10 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  begin
5
- require 'rbconfig'
6
- require 'logger'
5
+ require 'oboe/version'
6
+ require 'oboe/logger'
7
+ require 'oboe/util'
7
8
 
8
9
  # If Oboe_metal is already defined then we are in a PaaS environment
9
10
  # with an alternate metal (such as Heroku: see the oboe-heroku gem)
@@ -16,8 +17,7 @@ begin
16
17
  require 'oboe_metal'
17
18
  end
18
19
  end
19
- require 'oboe/logger'
20
- require 'oboe/util'
20
+
21
21
  require 'oboe/config'
22
22
  require 'oboe/loading'
23
23
  require 'method_profiling'
@@ -34,4 +34,5 @@ rescue LoadError
34
34
  $stderr.puts "=============================================================="
35
35
  rescue Exception => e
36
36
  $stderr.puts "[oboe/error] Problem loading: #{e.inspect}"
37
+ $stderr.puts e.backtrace
37
38
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -1,3 +1,6 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
1
4
  module Oboe
2
5
  module API
3
6
  module LayerInit
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -1,6 +1,6 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
- #
3
+
4
4
  module Oboe
5
5
  module API
6
6
  module Memcache
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -11,7 +11,9 @@ module Oboe
11
11
  #
12
12
  # profile_name - A name used to identify the block being profiled.
13
13
  # report_kvs - A hash containing key/value pairs that will be reported along
14
- # with the event of this profile (optional).
14
+ # with the event of this profile (optional).
15
+ # with_backtrace - Boolean to indicate whether a backtrace should
16
+ # be collected with this trace event.
15
17
  #
16
18
  # Example
17
19
  #
@@ -22,12 +24,12 @@ module Oboe
22
24
  # end
23
25
  #
24
26
  # Returns the result of the block.
25
- def profile(profile_name, report_kvs={})
27
+ def profile(profile_name, report_kvs={}, with_backtrace=false)
26
28
 
27
29
  report_kvs[:Language] ||= :ruby
28
30
  report_kvs[:ProfileName] ||= profile_name
29
31
 
30
- Oboe::Context.log(nil, 'profile_entry', report_kvs)
32
+ Oboe::Context.log(nil, 'profile_entry', report_kvs, with_backtrace)
31
33
 
32
34
  begin
33
35
  yield
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012 by Tracelytics, Inc.
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
4
  module Oboe
@@ -27,9 +27,23 @@ module Oboe
27
27
  @@instrumentation.each do |k|
28
28
  @@config[k] = {}
29
29
  @@config[k][:enabled] = true
30
+ @@config[k][:collect_backtraces] = false
30
31
  @@config[k][:log_args] = true
31
32
  end
32
33
 
34
+ # Set collect_backtraces defaults
35
+ Oboe::Config[:action_controller][:collect_backtraces] = true
36
+ Oboe::Config[:active_record][:collect_backtraces] = true
37
+ Oboe::Config[:action_view][:collect_backtraces] = true
38
+ Oboe::Config[:cassandra][:collect_backtraces] = true
39
+ Oboe::Config[:dalli][:collect_backtraces] = false
40
+ Oboe::Config[:memcache][:collect_backtraces] = false
41
+ Oboe::Config[:memcached][:collect_backtraces] = false
42
+ Oboe::Config[:mongo][:collect_backtraces] = true
43
+ Oboe::Config[:moped][:collect_backtraces] = true
44
+ Oboe::Config[:nethttp][:collect_backtraces] = true
45
+ Oboe::Config[:resque][:collect_backtraces] = true
46
+
33
47
  # Special instrument specific flags
34
48
  #
35
49
  # :link_workers - associates enqueue operations with the jobs they queue by piggybacking
@@ -47,8 +61,15 @@ module Oboe
47
61
  # avoid collecting and reporting query literals to TraceView.
48
62
  @@config[:sanitize_sql] = false
49
63
 
50
- update!(data)
51
-
64
+ # The default configuration
65
+ default_config = {
66
+ :tracing_mode => "through",
67
+ :reporter_host => "127.0.0.1",
68
+ :sample_rate => 300000,
69
+ :verbose => false
70
+ }
71
+ update!(default_config)
72
+
52
73
  # For Initialization, mark this as the default SampleRate
53
74
  @@config[:sample_source] = 2 # OBOE_SAMPLE_RATE_SOURCE_DEFAULT
54
75
  end
@@ -66,6 +87,10 @@ module Oboe
66
87
  def self.[]=(key, value)
67
88
  @@config[key.to_sym] = value
68
89
 
90
+ if key == :sampling_rate
91
+ Oboe.logger.warn "WARNING: :sampling_rate is not a supported setting for Oboe::Config. Please use :sample_rate."
92
+ end
93
+
69
94
  if key == :sample_rate
70
95
  # When setting SampleRate, note that it's been manually set
71
96
  # OBOE_SAMPLE_RATE_SOURCE_FILE == 1
@@ -113,11 +138,5 @@ module Oboe
113
138
  end
114
139
  end
115
140
 
116
- config = {
117
- :tracing_mode => "through",
118
- :reporter_host => "127.0.0.1",
119
- :sample_rate => 300000,
120
- :verbose => false }
121
-
122
- Oboe::Config.initialize(config)
141
+ Oboe::Config.initialize
123
142