oboe 1.4.0.2 → 1.4.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -113,7 +113,9 @@ module Oboe
113
113
  #
114
114
  # Returns nothing.
115
115
  def log_event(layer, label, event, opts={})
116
- event.addInfo('Layer', layer.to_s)
116
+ if layer
117
+ event.addInfo('Layer', layer.to_s)
118
+ end
117
119
  event.addInfo('Label', label.to_s)
118
120
 
119
121
  opts.each do |k, v|
@@ -3,16 +3,19 @@ module Oboe
3
3
  module Helpers
4
4
  extend ActiveSupport::Concern if ::Rails::VERSION::MAJOR > 2
5
5
 
6
+ @@rum_xhr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_ajax_header.js.erb')
7
+ @@rum_hdr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_header.js.erb')
8
+ @@rum_ftr_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_footer.js.erb')
9
+
6
10
  def oboe_rum_header
7
11
  begin
8
12
  return unless Oboe::Config.rum_id
9
13
  if Oboe.tracing?
10
14
  if request.xhr?
11
- header_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_ajax_header.js.erb')
15
+ return raw(ERB.new(@@rum_xhr_tmpl).result)
12
16
  else
13
- header_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_header.js.erb')
17
+ return raw(ERB.new(@@rum_hdr_tmpl).result)
14
18
  end
15
- return raw(ERB.new(header_tmpl).result)
16
19
  end
17
20
  rescue Exception => e
18
21
  logger.warn "oboe_rum_header: #{e.message}." if defined?(logger)
@@ -26,8 +29,7 @@ module Oboe
26
29
  if Oboe.tracing?
27
30
  # Even though the footer template is named xxxx.erb, there are no ERB tags in it so we'll
28
31
  # skip that step for now
29
- footer_tmpl = File.read(File.dirname(__FILE__) + '/rails/helpers/rum/rum_footer.js.erb')
30
- return raw(footer_tmpl)
32
+ return raw(@@rum_ftr_tmpl)
31
33
  end
32
34
  rescue Exception => e
33
35
  logger.warn "oboe_rum_footer: #{e.message}." if defined?(logger)
@@ -20,21 +20,15 @@ module Oboe
20
20
 
21
21
  def process_action_with_oboe(*args)
22
22
  report_kvs = {
23
- 'HTTP-Host' => @_request.headers['HTTP_HOST'],
24
- :URL => @_request.headers['REQUEST_URI'],
25
- :Method => @_request.headers['REQUEST_METHOD'],
26
23
  :Controller => self.class.name,
27
24
  :Action => self.action_name,
28
25
  }
29
- result = process_action_without_oboe *args
26
+ Oboe::API.log(nil, 'info', report_kvs)
30
27
 
31
- report_kvs[:Status] = @_response.status
32
- Oboe::API.log('rails', 'info', report_kvs)
33
-
34
- result
28
+ process_action_without_oboe *args
35
29
  rescue Exception => exception
36
30
  report_kvs[:Status] = 500
37
- Oboe::API.log('rails', 'info', report_kvs)
31
+ Oboe::API.log(nil, 'info', report_kvs)
38
32
  raise
39
33
  end
40
34
 
@@ -71,23 +65,15 @@ if defined?(ActionController::Base) and Oboe::Config[:action_controller][:enable
71
65
 
72
66
  def perform_action(*arguments)
73
67
  report_kvs = {
74
- 'HTTP-Host' => @_request.headers['HTTP_HOST'],
75
- :URL => @_request.headers['REQUEST_URI'],
76
- :Method => @_request.headers['REQUEST_METHOD'],
77
68
  :Controller => @_request.path_parameters['controller'],
78
69
  :Action => @_request.path_parameters['action']
79
70
  }
80
-
71
+ Oboe::API.log(nil, 'info', report_kvs)
81
72
  perform_action_without_oboe(*arguments)
82
- begin
83
- report_kvs[:Status] = @_response.status.to_i
84
- rescue
85
- end
86
- Oboe::API.log('rails', 'info', report_kvs)
87
73
  end
88
74
 
89
75
  def rescue_action(exn)
90
- Oboe::API.log_exception('rails', exn)
76
+ Oboe::API.log_exception(nil, exn)
91
77
  rescue_action_without_oboe(exn)
92
78
  end
93
79
 
@@ -101,3 +87,4 @@ if defined?(ActionController::Base) and Oboe::Config[:action_controller][:enable
101
87
  puts "[oboe/loading] Instrumenting actioncontroler" if Oboe::Config[:verbose]
102
88
  end
103
89
  # vim:set expandtab:tabstop=2
90
+
@@ -1,8 +1,6 @@
1
1
  # Copyright (c) 2012 by Tracelytics, Inc.
2
2
  # All rights reserved.
3
3
 
4
- require 'rack'
5
-
6
4
  module Oboe
7
5
  class Rack
8
6
  attr_reader :app
@@ -12,20 +10,35 @@ module Oboe
12
10
  end
13
11
 
14
12
  def call(env)
13
+ report_kvs = {}
15
14
  xtrace = env['HTTP_X_TRACE']
16
15
 
17
- report_kvs = {}
18
- report_kvs[:SampleRate] = Oboe::Config[:sample_rate]
16
+ begin
17
+ req = ::Rack::Request.new(env)
18
+ report_kvs[:SampleRate] = Oboe::Config[:sample_rate]
19
+ report_kvs['HTTP-Host'] = req.host
20
+ report_kvs['HTTP-Port'] = req.port
21
+ report_kvs['Query-String'] = req.query_string unless req.query_string.blank?
22
+ report_kvs[:URL] = req.path
23
+ report_kvs[:Method] = req.request_method
24
+ report_kvs['AJAX'] = true if req.xhr?
25
+ rescue
26
+ # Discard any potential exceptions. Report whatever we can.
27
+ end
28
+
29
+ result, xtrace = Oboe::API.start_trace('rack', xtrace, report_kvs) do
30
+
31
+ status, headers, response = @app.call(env)
32
+ Oboe::API.log(nil, 'info', { :Status => status })
19
33
 
20
- response, xtrace = Oboe::API.start_trace('rack', xtrace, report_kvs) do
21
- @app.call(env)
34
+ [status, headers, response]
22
35
  end
23
36
  rescue Exception => e
24
37
  xtrace = e.instance_variable_get(:@xtrace)
25
38
  raise
26
39
  ensure
27
- response[1].merge!({'X-Trace' => xtrace}) if xtrace
28
- return response
40
+ result[1]['X-Trace'] = xtrace if xtrace
41
+ return result
29
42
  end
30
43
  end
31
44
  end
@@ -2,7 +2,7 @@ module Oboe
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
6
6
  BUILD = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 123
4
+ hash: 127
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
9
+ - 1
10
10
  - 2
11
- version: 1.4.0.2
11
+ version: 1.4.1.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Tracelytics, Inc.
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-03-08 00:00:00 Z
19
+ date: 2013-04-19 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
22
  description: The oboe gem provides AppNeta instrumentation for Ruby and Ruby frameworks.