oboe 2.1.4 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,31 +1,41 @@
1
1
 
2
+ # oboe 2.2.0
3
+
4
+ * Initial support for Rails 4
5
+ * Various internal reporting fixes and improvements
6
+ * Fix for auto sampling rate
7
+
8
+ # oboe 2.1.4 (08/01/13)
9
+
10
+ * Integration support for AppView Web
11
+
2
12
  # oboe 2.1.3 (07/16/13)
3
13
 
4
14
  * Allow _Access Key_ assignment via Environment variable: TRACEVIEW_CUUID
5
15
 
6
- # oboe 2.1.1 (07/04/13)
16
+ # oboe 2.1.1
7
17
 
8
18
  * The gem now logs via a standard Ruby logger: Oboe.logger
9
19
  * Add in rspec tests
10
20
  * JRuby now supports Smart Tracing
11
21
  * Fixed an invalid Profile name in ActionView Partial tracing
12
22
 
13
- # oboe 1.4.2.2 (05/16/13)
23
+ # oboe 1.4.2.2
14
24
 
15
25
  * Rack - add handling for potential nil result
16
26
 
17
- # oboe 1.4.2 (05/02/13)
27
+ # oboe 1.4.2
18
28
 
19
29
  * Cassandra - ensure all keys are captured when reporting exceptions
20
30
  * JRuby detection fix
21
31
 
22
- # oboe 1.4.1.2 (04/29/13)
32
+ # oboe 1.4.1.2
23
33
 
24
34
  * HTTP keys now captured at Rack level instead of Rails
25
35
  * RUM templates are now pre-loaded
26
36
  * Improved layer agnostic info event reporting
27
37
 
28
- # oboe 1.4.0.2 (03/08/13)
38
+ # oboe 1.4.0.2
29
39
 
30
40
  * Resque support
31
41
  * Fix Rails 2 bug where SET and SHOW could result in recursive calls
@@ -35,49 +45,49 @@ of hits
35
45
  instrumentation
36
46
  * Configuration - sending Resque parameters can be skipped if privacy an issue.
37
47
 
38
- # oboe 1.3.9.1 (02/04/13)
48
+ # oboe 1.3.9.1
39
49
 
40
50
  * Add in Rack instrumentation
41
51
  * Fix Function profiling of class methods bug
42
52
  * Add backtraces to Cassandra and Mongo operations
43
53
  * Rename the "render" layer to "actionview"
44
54
 
45
- # oboe 1.3.8 (01/04/13)
55
+ # oboe 1.3.8
46
56
 
47
57
  * More comprehensive JRuby support
48
58
 
49
- # oboe 1.3.7 (12/10/12)
59
+ # oboe 1.3.7
50
60
 
51
61
  * Added Moped driver instrumentation (Mongo/Mongoid)
52
62
 
53
- # oboe 1.3.6 (12/10/12)
63
+ # oboe 1.3.6
54
64
 
55
65
  * Added Rails ActionView partial and collection rendering instrumentation
56
66
 
57
- # oboe 1.3.5 (11/14/12)
67
+ # oboe 1.3.5
58
68
 
59
69
  * Added cassandra instrumentation
60
70
 
61
- # oboe 1.3.4 (10/23/12)
71
+ # oboe 1.3.4
62
72
 
63
73
  * Added mongo-ruby-driver support
64
74
 
65
- # oboe 1.3.3 (10/18/12)
75
+ # oboe 1.3.3
66
76
 
67
77
  * Updated RUM instrumentation templates
68
78
 
69
- # oboe 1.3.2 (10/17/12)
79
+ # oboe 1.3.2
70
80
 
71
81
  * Fix a case when the RUM instrumentation header/footer methods would not
72
82
  return JS output, depending on how the way they were called from HAML.
73
83
 
74
- # oboe 1.3.1 (10/15/12)
84
+ # oboe 1.3.1
75
85
 
76
86
  * Support for RUM instrumentation.
77
87
  Fix for certain cases where exceptions were not properly propagated up to Rails
78
88
  error handlers.
79
89
 
80
- # oboe 1.3.0 (9/26/12)
90
+ # oboe 1.3.0
81
91
 
82
92
  * The oboe and oboe_fu gems have been merged to simplify installation. The
83
93
  final oboe_fu gem (1.3.0) simply calls "require 'oboe'" now for backwards
@@ -88,11 +98,11 @@ Ruby oboe API methods.
88
98
  base packages (liboboe) installed, so you can deploy to environments with or
89
99
  without TraceView support.
90
100
 
91
- # oboe_fu 1.2.1 (9/12/12)
101
+ # oboe_fu 1.2.1
92
102
 
93
103
  * Support for instrumenting the dalli module.
94
104
 
95
- # oboe_fu 1.2.0 (8/28/12)
105
+ # oboe_fu 1.2.0
96
106
 
97
107
  * Support for Rails 2.3, 3.0, 3.1, and 3.2.
98
108
 
@@ -6,6 +6,7 @@ module Oboe
6
6
  def self.extend_with_tracing
7
7
  extend Oboe::API::Logging
8
8
  extend Oboe::API::Tracing
9
+ extend Oboe::API::Profiling
9
10
  extend Oboe::API::LayerInit
10
11
  end
11
12
  extend Oboe::API::Util
@@ -9,12 +9,12 @@ module Oboe
9
9
  platform_info = { '__Init' => 1 }
10
10
 
11
11
  begin
12
- platform_info['Force'] = true
13
- platform_info['RubyPlatformVersion'] = RUBY_PLATFORM
14
- platform_info['RubyVersion'] = RUBY_VERSION
15
- platform_info['RailsVersion'] = ::Rails.version if defined?(Rails)
16
- platform_info['OboeRubyVersion'] = Oboe::Version::STRING
17
- platform_info['OboeHerokuRubyVersion'] = OboeHeroku::Version::STRING if defined?(OboeHeroku)
12
+ platform_info['Force'] = true
13
+ platform_info['Ruby.Platform.Version'] = RUBY_PLATFORM
14
+ platform_info['Ruby.Version'] = RUBY_VERSION
15
+ platform_info['Ruby.Rails.Version'] = ::Rails.version if defined?(::Rails)
16
+ platform_info['Ruby.Oboe.Version'] = ::Oboe::Version::STRING
17
+ platform_info['Ruby.OboeHeroku.Version'] = ::OboeHeroku::Version::STRING if defined?(::OboeHeroku)
18
18
  rescue
19
19
  end
20
20
 
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 2012 by Tracelytics, Inc.
2
+ # All rights reserved.
3
+
4
+ module Oboe
5
+ module API
6
+ module Profiling
7
+
8
+ ##
9
+ # Public: Profile a given block of code. Detect any exceptions thrown by
10
+ # the block and report errors.
11
+ #
12
+ # profile_name - A name used to identify the block being profiled.
13
+ # report_kvs - A hash containing key/value pairs that will be reported along
14
+ # with the event of this profile (optional).
15
+ #
16
+ # Example
17
+ #
18
+ # def computation(n)
19
+ # Oboe::API.profile('fib', { :n => n }) do
20
+ # fib(n)
21
+ # end
22
+ # end
23
+ #
24
+ # Returns the result of the block.
25
+ def profile(profile_name, report_kvs={})
26
+
27
+ report_kvs[:Language] ||= :ruby
28
+ report_kvs[:ProfileName] ||= profile_name
29
+
30
+ Oboe::Context.log(nil, 'profile_entry', report_kvs)
31
+
32
+ begin
33
+ yield
34
+ rescue Exception => e
35
+ log_exception(nil, e)
36
+ raise
37
+ ensure
38
+ exit_kvs = {}
39
+ exit_kvs[:Language] = :ruby
40
+ exit_kvs[:ProfileName] = report_kvs[:ProfileName]
41
+
42
+ Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -43,6 +43,9 @@ module Oboe
43
43
  @@config[:blacklist] = []
44
44
 
45
45
  update!(data)
46
+
47
+ # For Initialization, mark this as the default SampleRate
48
+ @@config[:sample_source] = 2 # OBOE_SAMPLE_RATE_SOURCE_DEFAULT
46
49
  end
47
50
 
48
51
  def self.update!(data)
@@ -57,6 +60,35 @@ module Oboe
57
60
 
58
61
  def self.[]=(key, value)
59
62
  @@config[key.to_sym] = value
63
+
64
+ if key == :sample_rate
65
+ # When setting SampleRate, note that it's been manually set
66
+ # OBOE_SAMPLE_RATE_SOURCE_FILE == 1
67
+ @@config[:sample_source] = 1
68
+
69
+ # Validate :sample_rate value
70
+ unless value.between?(1, 1e6)
71
+ raise "oboe :sample_rate must be between 1 and 1000000 (1m)"
72
+ end
73
+
74
+ # Update liboboe with the new SampleRate value
75
+ Oboe::Context.setDefaultSampleRate(value)
76
+ end
77
+
78
+ # Update liboboe if updating :tracing_mode
79
+ if key == :tracing_mode
80
+ case value.downcase
81
+ when 'never'
82
+ # OBOE_TRACE_NEVER
83
+ Oboe::Context.setTracingMode(0)
84
+ when 'always'
85
+ # OBOE_TRACE_ALWAYS
86
+ Oboe::Context.setTracingMode(1)
87
+ else
88
+ # OBOE_TRACE_THROUGH
89
+ Oboe::Context.setTracingMode(2)
90
+ end
91
+ end
60
92
  end
61
93
 
62
94
  def self.method_missing(sym, *args)
@@ -108,7 +108,6 @@ if defined?(::Rails)
108
108
 
109
109
  config.after_initialize do
110
110
  Oboe::Loading.setup_logger
111
- Oboe::Loading.set_tracing_mode
112
111
  Oboe::Loading.load_access_key
113
112
  Oboe::Inst.load_instrumentation
114
113
  Oboe::Rails.load_instrumentation
@@ -118,7 +117,6 @@ if defined?(::Rails)
118
117
  else
119
118
  Oboe::Loading.setup_logger
120
119
  Oboe::Rails.load_initializer
121
- Oboe::Loading.set_tracing_mode
122
120
  Oboe::Loading.load_access_key
123
121
 
124
122
  Rails.configuration.after_initialize do
@@ -6,9 +6,9 @@ module Oboe
6
6
  module Rails3ActionController
7
7
  def self.included(base)
8
8
  base.class_eval do
9
- alias_method_chain :render, :oboe
10
9
  alias_method_chain :process, :oboe
11
10
  alias_method_chain :process_action, :oboe
11
+ alias_method_chain :render, :oboe
12
12
  end
13
13
  end
14
14
 
@@ -38,15 +38,47 @@ module Oboe
38
38
  end
39
39
  end
40
40
  end
41
+
42
+ module Rails4ActionController
43
+ def self.included(base)
44
+ base.class_eval do
45
+ alias_method_chain :process_action, :oboe
46
+ alias_method_chain :render, :oboe
47
+ end
48
+ end
49
+
50
+ def process_action_with_oboe(method_name, *args)
51
+ report_kvs = {
52
+ :Controller => self.class.name,
53
+ :Action => self.action_name,
54
+ }
55
+ Oboe::API.trace('rails', report_kvs) do
56
+ process_action_without_oboe(method_name, *args)
57
+ end
58
+ end
59
+
60
+ def render_with_oboe(*args)
61
+ Oboe::API.trace('actionview', {}) do
62
+ render_without_oboe(*args)
63
+ end
64
+ end
65
+ end
41
66
  end
42
67
  end
43
68
 
44
69
  if defined?(ActionController::Base) and Oboe::Config[:action_controller][:enabled]
45
- if ::Rails::VERSION::MAJOR == 3
70
+ if ::Rails::VERSION::MAJOR == 4
71
+
72
+ class ActionController::Base
73
+ include Oboe::Inst::Rails4ActionController
74
+ end
75
+
76
+ elsif ::Rails::VERSION::MAJOR == 3
46
77
 
47
78
  class ActionController::Base
48
79
  include Oboe::Inst::Rails3ActionController
49
80
  end
81
+
50
82
  elsif ::Rails::VERSION::MAJOR == 2
51
83
 
52
84
  ActionController::Base.class_eval do
@@ -3,190 +3,54 @@
3
3
 
4
4
  if defined?(ActionView::Base) and Oboe::Config[:action_view][:enabled]
5
5
 
6
- if Rails::VERSION::MAJOR == 3
7
- Oboe.logger.info "[oboe/loading] Instrumenting actionview" if Oboe::Config[:verbose]
8
-
9
- if Rails::VERSION::MINOR == 0
10
- ActionView::Partials::PartialRenderer.class_eval do
11
- alias :render_partial_without_oboe :render_partial
12
- def render_partial(object = @object)
13
- entry_kvs = {}
14
- begin
15
- entry_kvs[:Language] = :ruby
16
- entry_kvs[:FunctionName] = :render_partial
17
- entry_kvs[:Class] = :PartialRenderer
18
- entry_kvs[:Module] = 'ActionView::Partials'
19
- entry_kvs[:File] = __FILE__
20
- entry_kvs[:LineNumber] = __LINE__
21
- entry_kvs[:ProfileName] = @options[:partial].to_s if @options.is_a?(Hash)
22
- rescue
23
- end
24
-
25
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
26
- ret = render_partial_without_oboe(object)
27
-
28
- exit_kvs = {}
29
- begin
30
- exit_kvs[:Language] = :ruby
31
- exit_kvs[:ProfileName] = @options[:partial].to_s if @options.is_a?(Hash)
32
- rescue
33
- end
34
-
35
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
36
- ret
37
- end
38
-
39
- alias :render_collection_without_oboe :render_collection
40
- def render_collection
41
- entry_kvs = {}
42
- begin
43
- entry_kvs[:Language] = :ruby
44
- entry_kvs[:ProfileName] = @path
45
- entry_kvs[:FunctionName] = :render_collection
46
- entry_kvs[:Class] = :PartialRenderer
47
- entry_kvs[:Module] = 'ActionView::Partials'
48
- entry_kvs[:File] = __FILE__
49
- entry_kvs[:LineNumber] = __LINE__
50
- rescue
51
- end
52
-
53
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
54
- ret = render_collection_without_oboe
55
-
56
- exit_kvs = {}
57
- begin
58
- exit_kvs[:Language] = :ruby
59
- exit_kvs[:ProfileName] = @path
60
- rescue
61
- end
62
-
63
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
64
- ret
65
- end
66
- end
67
- else
68
- ActionView::PartialRenderer.class_eval do
69
- alias :render_partial_without_oboe :render_partial
70
- def render_partial
71
- entry_kvs = {}
72
- begin
73
- entry_kvs[:Language] = :ruby
74
- entry_kvs[:FunctionName] = :render_partial
75
- entry_kvs[:Class] = :PartialRenderer
76
- entry_kvs[:Module] = :ActionView
77
- entry_kvs[:File] = __FILE__
78
- entry_kvs[:LineNumber] = __LINE__
79
- entry_kvs[:ProfileName] = @options[:partial].to_s if @options.is_a?(Hash)
80
- rescue
81
- end
82
-
83
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
84
- ret = render_partial_without_oboe
85
-
86
- exit_kvs = {}
87
- begin
88
- exit_kvs[:Language] = :ruby
89
- exit_kvs[:ProfileName] = @options[:partial].to_s if @options.is_a?(Hash)
90
- rescue
91
- end
92
-
93
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
94
- ret
95
- end
96
-
97
- alias :render_collection_without_oboe :render_collection
98
- def render_collection
99
- entry_kvs = {}
100
- begin
101
- entry_kvs[:Language] = :ruby
102
- entry_kvs[:ProfileName] = @path
103
- entry_kvs[:FunctionName] = :render_collection
104
- entry_kvs[:Class] = :PartialRenderer
105
- entry_kvs[:Module] = :ActionView
106
- entry_kvs[:File] = __FILE__
107
- entry_kvs[:LineNumber] = __LINE__
108
- rescue
109
- end
110
-
111
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
112
- ret = render_collection_without_oboe
6
+ ##
7
+ # ActionView Instrumentation is version dependent. ActionView 2.x is separate
8
+ # and ActionView 3.0 is a special case.
9
+ # Everything else goes here. (ActionView 3.1 - 4.0 as of this writing)
10
+ #
11
+ if (Rails::VERSION::MAJOR == 3 and Rails::VERSION::MINOR > 0) or Rails::VERSION::MAJOR == 4
113
12
 
114
- exit_kvs = {}
115
- begin
116
- exit_kvs[:Language] = :ruby
117
- exit_kvs[:ProfileName] = @path
118
- rescue
119
- end
120
-
121
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
122
- ret
123
- end
124
- end
125
- end
126
- elsif Rails::VERSION::MAJOR == 2
127
13
  Oboe.logger.info "[oboe/loading] Instrumenting actionview" if Oboe::Config[:verbose]
128
14
 
129
- ActionView::Partials.module_eval do
15
+ ActionView::PartialRenderer.class_eval do
130
16
  alias :render_partial_without_oboe :render_partial
131
- def render_partial(options = {})
132
- if options.has_key?(:partial) and options[:partial].is_a?(String)
133
- entry_kvs = {}
134
- begin
135
- entry_kvs[:Language] = :ruby
136
- entry_kvs[:FunctionName] = :render_partial
137
- entry_kvs[:Class] = :Partials
138
- entry_kvs[:Module] = :ActionView
139
- entry_kvs[:File] = __FILE__
140
- entry_kvs[:LineNumber] = __LINE__
141
- entry_kvs[:ProfileName] = options[:partial].to_s if options.is_a?(Hash)
142
- rescue
143
- end
144
-
145
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
146
- ret = render_partial_without_oboe(options)
147
-
148
- exit_kvs = {}
149
- begin
150
- exit_kvs[:Language] = :ruby
151
- exit_kvs[:ProfileName] = options[:partial].to_s if options.is_a?(Hash)
152
- rescue
153
- end
154
-
155
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
156
- else
157
- ret = render_partial_without_oboe(options)
158
- end
159
- ret
160
- end
161
-
162
- alias :render_partial_collection_without_oboe :render_partial_collection
163
- def render_partial_collection(options = {})
17
+ def render_partial
164
18
  entry_kvs = {}
165
19
  begin
166
- entry_kvs[:Language] = :ruby
167
- entry_kvs[:ProfileName] = :collection
168
- entry_kvs[:FunctionName] = :render_partial_collection
169
- entry_kvs[:Class] = :Partials
20
+ name = @options[:partial].to_s if @options.is_a?(Hash)
21
+ entry_kvs[:FunctionName] = :render_partial
22
+ entry_kvs[:Class] = :PartialRenderer
170
23
  entry_kvs[:Module] = :ActionView
171
24
  entry_kvs[:File] = __FILE__
172
25
  entry_kvs[:LineNumber] = __LINE__
173
26
  rescue
174
27
  end
175
28
 
176
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
177
- ret = render_partial_collection_without_oboe(options)
29
+ Oboe::API.profile(name, entry_kvs) do
30
+ render_partial_without_oboe
31
+ end
32
+ end
178
33
 
179
- exit_kvs = {}
34
+ alias :render_collection_without_oboe :render_collection
35
+ def render_collection
36
+ entry_kvs = {}
180
37
  begin
181
- exit_kvs[:Language] = :ruby
182
- exit_kvs[:ProfileName] = :collection
38
+ name = @path.to_s
39
+ entry_kvs[:FunctionName] = :render_collection
40
+ entry_kvs[:Class] = :PartialRenderer
41
+ entry_kvs[:Module] = :ActionView
42
+ entry_kvs[:File] = __FILE__
43
+ entry_kvs[:LineNumber] = __LINE__
183
44
  rescue
184
45
  end
185
46
 
186
- Oboe::Context.log(nil, 'profile_exit', exit_kvs, false)
187
- ret
47
+ Oboe::API.profile(name, entry_kvs) do
48
+ ret = render_collection_without_oboe
49
+ end
188
50
  end
51
+
189
52
  end
190
53
  end
191
54
  end
55
+
192
56
  # vim:set expandtab:tabstop=2