oboe 2.3.2 → 2.3.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 45fc7604fa67548997b691856dbd87e2e769a1a6
4
+ data.tar.gz: 4c1b623a594db6e3894482f018af8c68dea5562c
5
+ SHA512:
6
+ metadata.gz: ce0e2ad674ade428b114ab3f3431d57cd573bb59110e49ebde9ccf55804076632190b904174ef3a511cf260e8f651765aa0591544073df5fba7164de311b3334
7
+ data.tar.gz: 89e7abdfa4c4d0a0adae647b5ac231043e9620097cd97c158bdea3071f02759c95a970554b5b35c5b9eaedaa568596deda634c17231f7844291aa0826cb8a6ef
data/.travis.yml ADDED
@@ -0,0 +1,26 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - 1.8.7
7
+ - ree
8
+
9
+ # Attempt Travis/Cassandra fix re: https://github.com/travis-ci/travis-ci/issues/1484
10
+ before_install:
11
+ - echo "127.0.0.1 " `hostname` | sudo tee /etc/hosts
12
+ - sudo service cassandra start
13
+
14
+ install:
15
+ - wget https://www.tracelytics.com/install_tracelytics.sh
16
+ - sudo sh ./install_tracelytics.sh f51e2a43-0ee5-4851-8a54-825773b3218e
17
+
18
+ before_script:
19
+ - bundle install
20
+ - bundle exec rake compile
21
+
22
+ services:
23
+ - mongodb
24
+ - memcached
25
+ # - cassandra
26
+
data/CHANGELOG CHANGED
@@ -1,5 +1,31 @@
1
-
2
- # oboe 2.2.0
1
+ # oboe 2.3.3 (11/06/13)
2
+
3
+ * Rename the _Init layer to "rack"
4
+ * Decode URLS when reporting them
5
+ * Resque layer naming split into 1) client queuing of a job: 'resque-client', 2) Resque worker running a job: 'resque-worker'
6
+ * Fix for an extension load error and some refactoring of functionality into a base module (OboeBase)
7
+ * Improved and more resilient method profiling
8
+ * Further refactoring for Ruby 2.0 support
9
+ * Track the version of the instrumentation installed
10
+
11
+ # oboe 2.3.2 (10/22/13)
12
+
13
+ * Backtrace collection can now be configured to skip certain components if a lighter-weight trace is desired
14
+ * On MRI Ruby the hostname of the Tracelyzer is now configurable via Oboe::Config[:reporter_host] (default is localhost)
15
+ * Fix to MongoDb query identification
16
+ * Event building in the Rack layer optimized
17
+ * Renamed "sampling_rate" to be "sample_rate" for consistency
18
+ * More tests added and documentation in anticipation of our Ruby open-source initiative
19
+
20
+ # oboe 2.2.6 (09/27/13)
21
+
22
+ * Query Privacy now fully supported; can configure the app to not send SQL parameters if needed
23
+ * Configuring the local sample rate now supports 1e6 notation
24
+ * Improved log messaging if a gem dependency is missing
25
+ * Now reporting HTTPStatus on http client calls
26
+ * Heroku - the start time when a request hits the load balancer now captured
27
+
28
+ # oboe 2.2.0 (09/12/13)
3
29
 
4
30
  * Initial support for Rails 4
5
31
  * Various internal reporting fixes and improvements
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gem 'appraisal'
9
9
  group :development, :test do
10
10
  gem 'minitest'
11
11
  gem 'minitest-reporters'
12
- gem 'debugger'
12
+ gem 'debugger' unless (RUBY_VERSION =~ /^1.8/) == 0
13
13
  gem 'rack-test'
14
14
  end
15
15
 
@@ -20,7 +20,7 @@ gem 'memcached' if (RUBY_VERSION =~ /^1./) == 0
20
20
  gem 'cassandra'
21
21
  gem 'mongo'
22
22
  gem 'bson_ext' # For Mongo, Yours Truly
23
- gem 'moped'
23
+ gem 'moped' unless (RUBY_VERSION =~ /^1.8/) == 0
24
24
  gem 'resque'
25
25
  gem 'rack-test'
26
26
 
data/README.md CHANGED
@@ -45,8 +45,8 @@ You can instrument your Sinatra or Padrino application by adding the following c
45
45
  require 'oboe/inst/rack'
46
46
 
47
47
  # When traces should be initiated for incoming requests. Valid options are
48
- # always,” through (when the request is initiated with a tracing header
49
- # from upstream) and never”. You must set this directive to always in
48
+ # "always", "through" (when the request is initiated with a tracing header
49
+ # from upstream) and "never". You must set this directive to "always" in
50
50
  # order to initiate tracing.
51
51
  Oboe::Config[:tracing_mode] = 'through'
52
52
 
@@ -125,7 +125,7 @@ This example demonstrates method profiling of instance methods. Class methods a
125
125
 
126
126
  # Support
127
127
 
128
- If you find a bug or would like to request an enhancement, feel free to file an issue. For all other support requests, see our [support portal](https://support.tv.appneta.com/) or on IRC @ #appneta on Freenode.
128
+ If you find a bug or would like to request an enhancement, feel free to file an issue. For all other support requests, see our [support portal](https://support.tv.appneta.com/) or on IRC @ #appneta on [Freenode](http://freenode.net/).
129
129
 
130
130
  # Contributing
131
131
 
@@ -257,7 +257,7 @@ Note: Make sure you have the development package `liboboe0-dev` installed before
257
257
  ii liboboe-dev 1.1.1-precise1 Tracelytics common library -- development files
258
258
  ii liboboe0 1.1.1-precise1 Tracelytics common library
259
259
 
260
- See [Installing Base Packages on Debian and Ubuntu](https://support.tv.appneta.com/support/solutions/articles/86359-installing-base-packages-on-debian-and-ubuntu) in the Knowledge Base for details. Our hacker extraodinaire [Rob Salmond](https://github.com/rsalmond) from the support team have even gotten these packages to [run on Gentoo](http://www.appneta.com/blog/unsupported-doesnt-work/)!
260
+ See [Installing Base Packages on Debian and Ubuntu](https://support.tv.appneta.com/support/solutions/articles/86359-installing-base-packages-on-debian-and-ubuntu) in the Knowledge Base for details. Our hacker extraodinaire [Rob Salmond](https://github.com/rsalmond) from the support team has even gotten these packages to [run on Gentoo](http://www.appneta.com/blog/unsupported-doesnt-work/)!
261
261
 
262
262
  To see the code related to the C extension, take a look at `ext/oboe_metal/extconf.rb` for details.
263
263
 
data/Rakefile CHANGED
@@ -28,10 +28,16 @@ task :compile do
28
28
  sh cmd.join(' ')
29
29
  sh '/usr/bin/env make'
30
30
  File.delete symlink if File.exist? symlink
31
- File.symlink so_file, symlink
32
31
 
33
- Dir.chdir pwd
34
- puts "== Extension built and symlink'd to #{symlink}"
32
+ if File.exists? so_file
33
+ File.symlink so_file, symlink
34
+ Dir.chdir pwd
35
+ puts "== Extension built and symlink'd to #{symlink}"
36
+ else
37
+ Dir.chdir pwd
38
+ puts "!! Extension failed to build (see above). Are the base TraceView packages installed?"
39
+ puts "!! See https://support.tv.appneta.com/support/solutions/articles/86359"
40
+ end
35
41
  end
36
42
 
37
43
  desc "Clean up extension build files"
@@ -55,12 +61,17 @@ task :distclean do
55
61
  lib_dir = File.expand_path('lib')
56
62
  symlink = File.expand_path('lib/oboe_metal.so')
57
63
  so_file = File.expand_path('ext/oboe_metal/oboe_metal.so')
64
+ mkmf_log = File.expand_path('ext/oboe_metal/mkmf.log')
58
65
 
59
- Dir.chdir ext_dir
60
- File.delete symlink if File.exist? symlink
61
- sh '/usr/bin/env make distclean'
66
+ if File.exists? mkmf_log
67
+ Dir.chdir ext_dir
68
+ File.delete symlink if File.exist? symlink
69
+ sh '/usr/bin/env make distclean'
62
70
 
63
- Dir.chdir pwd
71
+ Dir.chdir pwd
72
+ else
73
+ puts "Nothing to distclean. (nothing built yet?)"
74
+ end
64
75
  end
65
76
 
66
77
  desc "Rebuild the gem's c extension"
data/lib/base.rb ADDED
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ module OboeBase
5
+ attr_accessor :reporter
6
+ attr_accessor :loaded
7
+
8
+ def self.included(cls)
9
+ self.loaded = true
10
+ end
11
+
12
+ def always?
13
+ Oboe::Config[:tracing_mode].to_s == "always"
14
+ end
15
+
16
+ def never?
17
+ Oboe::Config[:tracing_mode].to_s == "never"
18
+ end
19
+
20
+ def passthrough?
21
+ ["always", "through"].include?(Oboe::Config[:tracing_mode])
22
+ end
23
+
24
+ def through?
25
+ Oboe::Config[:tracing_mode] == "through"
26
+ end
27
+
28
+ def tracing?
29
+ return false unless Oboe.loaded
30
+
31
+ Oboe::Context.isValid and not Oboe.never?
32
+ end
33
+
34
+ def log(layer, label, options = {})
35
+ Context.log(layer, label, options = options)
36
+ end
37
+
38
+ ##
39
+ # These methods should be implemented by the descendants
40
+ # (Oboe_metal, Oboe_metal (JRuby), Heroku_metal)
41
+ #
42
+ def sample?(opts = {})
43
+ raise "sample? should be implemented by metal layer."
44
+ end
45
+
46
+ def log(layer, label, options = {})
47
+ raise "log should be implemented by metal layer."
48
+ end
49
+
50
+ def set_tracing_mode(mode)
51
+ raise "set_tracing_mode should be implemented by metal layer."
52
+ end
53
+
54
+ def set_sample_rate(rate)
55
+ raise "set_sample_rate should be implemented by metal layer."
56
+ end
57
+ end
58
+
data/lib/joboe_metal.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2013 AppNeta, Inc.
2
2
  # All rights reserved.
3
3
 
4
- module Oboe_metal
4
+ module Oboe_metal < MetalBase
5
5
  include_package 'com.tracelytics.joboe'
6
6
  import 'com.tracelytics.joboe'
7
7
  include_package 'com.tracelytics.joboe.SettingsReader'
@@ -12,46 +12,42 @@ 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 = false)
16
- evt = Oboe::Context.createEvent()
17
- evt.addInfo("Layer", layer.to_s)
18
- evt.addInfo("Label", label.to_s)
19
-
20
- options.each_pair do |k, v|
21
- evt.addInfo(k.to_s, v.to_s)
22
- end
23
-
24
- evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
25
-
26
- Oboe::Reporter.sendReport(evt)
27
- end
15
+ class << self
16
+ attr_accessor :layer_op
17
+
18
+ def log(layer, label, options = {}, with_backtrace = false)
19
+ evt = Oboe::Context.createEvent()
20
+ evt.addInfo("Layer", layer.to_s)
21
+ evt.addInfo("Label", label.to_s)
28
22
 
29
- def self.layer_op=(op)
30
- @layer_op = op
31
- end
23
+ options.each_pair do |k, v|
24
+ evt.addInfo(k.to_s, v.to_s)
25
+ end
32
26
 
33
- def self.layer_op
34
- @layer_op
35
- end
27
+ evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
36
28
 
37
- def self.tracing_layer_op?(operation)
38
- if operation.is_a?(Array)
39
- return operation.include?(@layer_op)
40
- else
41
- return @layer_op == operation
29
+ Oboe.reporter.sendReport(evt)
30
+ end
31
+
32
+ def tracing_layer_op?(operation)
33
+ if operation.is_a?(Array)
34
+ return operation.include?(@layer_op)
35
+ else
36
+ return @layer_op == operation
37
+ end
38
+ end
39
+
40
+ def toString
41
+ md = getMetadata.toString
42
42
  end
43
- end
44
-
45
- def self.toString
46
- md = getMetadata.toString
47
- end
48
43
 
49
- def self.clear
50
- clearMetadata
51
- end
44
+ def clear
45
+ clearMetadata
46
+ end
52
47
 
53
- def self.get
54
- getMetadata
48
+ def get
49
+ getMetadata
50
+ end
55
51
  end
56
52
  end
57
53
 
@@ -75,15 +71,17 @@ module Oboe_metal
75
71
  #
76
72
  def self.start
77
73
  begin
74
+ return unless Oboe.loaded
75
+
78
76
  Oboe_metal::Context.init()
79
77
 
80
78
  if ENV['RACK_ENV'] == "test"
81
- Oboe.reporter = Oboe::FileReporter.new("./tmp/trace_output.bson")
79
+ Oboe.reporter = Oboe::FileReporter.new("/tmp/trace_output.bson")
82
80
  else
83
81
  Oboe.reporter = Oboe::UdpReporter.new(Oboe::Config[:reporter_host])
84
82
  end
85
83
 
86
- Oboe::API.report_init('ruby') unless ["development", "test"].include? ENV['RACK_ENV']
84
+ Oboe::API.report_init('rack') unless ["development", "test"].include? ENV['RACK_ENV']
87
85
 
88
86
  rescue Exception => e
89
87
  $stderr.puts e.message
@@ -97,28 +95,11 @@ module Oboe_metal
97
95
  end
98
96
  end
99
97
 
100
- module Oboe
98
+ module Oboe
99
+ extend OboeBase
101
100
  include Oboe_metal
102
101
 
103
102
  class << self
104
- attr_accessor :reporter
105
-
106
- def always?
107
- Oboe::Config[:tracing_mode].to_s == "always"
108
- end
109
-
110
- def log(layer, label, options = {})
111
- Context.log(layer, label, options = options)
112
- end
113
-
114
- def never?
115
- Oboe::Config[:tracing_mode].to_s == "never"
116
- end
117
-
118
- def passthrough?
119
- ["always", "through"].include?(Oboe::Config[:tracing_mode])
120
- end
121
-
122
103
  def sample?(opts = {})
123
104
  # Assure defaults since SWIG enforces Strings
124
105
  opts[:layer] ||= ''
@@ -126,13 +107,15 @@ module Oboe
126
107
  opts['X-TV-Meta'] ||= ''
127
108
  Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest(opts[:layer], opts[:xtrace], opts['X-TV-Meta'])
128
109
  end
129
-
130
- def through?
131
- Oboe::Config[:tracing_mode] == "through"
110
+
111
+ def set_tracing_mode(mode)
112
+ # FIXME: TBD
132
113
  end
133
-
134
- def tracing?
135
- Oboe::Context.isValid and not Oboe.never?
114
+
115
+ def set_sample_rate(rate)
116
+ # FIXME: TBD
136
117
  end
137
118
  end
138
119
  end
120
+
121
+ Oboe.loaded = true
@@ -8,70 +8,63 @@ module OboeMethodProfiling
8
8
 
9
9
  module ClassMethods
10
10
  def profile_method(method_name, profile_name, store_args=false, store_return=false, profile=false)
11
- #this only gets file and line where profiling is turned on, presumably
12
- #right after the function definition. ruby 1.9 has nice introspection (Method.source_location)
13
- #but its appears no such luck for ruby 1.8
14
- version = RbConfig::CONFIG['ruby_version']
15
- file = nil
16
- line = nil
17
- if version and version.match(/^1.9/)
18
- info = self.instance_method(method_name).source_location
19
- if !info.nil?
20
- file = info[0]
21
- line = info[1]
11
+ begin
12
+ # this only gets file and line where profiling is turned on, presumably
13
+ # right after the function definition. ruby 1.9 and 2.0 has nice introspection (Method.source_location)
14
+ # but its appears no such luck for ruby 1.8
15
+ version = RbConfig::CONFIG['ruby_version']
16
+ file = ''
17
+ line = ''
18
+ if version and (version.match(/^1.9/) or version.match(/^2.0/))
19
+ info = self.instance_method(method_name).source_location
20
+ if !info.nil?
21
+ file = info[0].to_s
22
+ line = info[1].to_s
23
+ end
24
+ else
25
+ info = Kernel.caller[0].split(':')
26
+ file = info.first.to_s
27
+ line = info.last.to_s
22
28
  end
23
- else
24
- info = Kernel.caller[0].split(':')
25
- file = info.first
26
- line = info.last
27
- end
28
-
29
- #profiling via ruby-prof, is it possible to get return value of profiled code?
30
- code = "def _oboe_profiled_#{method_name}(*args, &block)
31
- def pps(*args)
32
- old_out = $stdout
33
- begin
34
- s = StringIO.new
35
- $stdout = s
36
- pp(*args)
37
- ensure
38
- $stdout = old_out
39
- end
40
- s.string
41
- end
42
-
43
- entry_kvs = {'Language' => 'ruby',
44
- 'ProfileName' => '#{profile_name}',
45
- 'FunctionName' => '#{method_name}',
46
- 'Class' => self.class.to_s.rpartition('::').last,
47
- 'Module' => self.class.to_s.rpartition('::').first,
48
- 'File' => '#{file}',
49
- 'LineNumber' => '#{line}'
50
- }
51
29
 
52
- if #{store_args}
53
- entry_kvs['Args'] = pps *args
54
- end
30
+ # Safety: Make sure there are no quotes or double quotes to break the class_eval
31
+ file = file.gsub /[\'\"]/, ''
32
+ line = line.gsub /[\'\"]/, ''
33
+
34
+ # profiling via ruby-prof, is it possible to get return value of profiled code?
35
+ code = "def _oboe_profiled_#{method_name}(*args, &block)
36
+ entry_kvs = {}
37
+ entry_kvs['Language'] = 'ruby'
38
+ entry_kvs['ProfileName'] = '#{profile_name}'
39
+ entry_kvs['FunctionName'] = '#{method_name}'
40
+ entry_kvs['File'] = '#{file}'
41
+ entry_kvs['LineNumber'] = '#{line}'
42
+ entry_kvs['Args'] = Oboe::API.pps(*args) if #{store_args}
43
+ entry_kvs.merge!(::Oboe::API.get_class_name(self))
55
44
 
56
- Oboe::Context.log(nil, 'profile_entry', entry_kvs)
45
+ Oboe::Context.log(nil, 'profile_entry', entry_kvs)
57
46
 
58
- ret = _oboe_orig_#{method_name}(*args, &block)
47
+ ret = _oboe_orig_#{method_name}(*args, &block)
59
48
 
60
- exit_kvs = {'Language' => 'ruby',
61
- 'ProfileName' => '#{profile_name}'
62
- }
63
-
64
- if #{store_return}
65
- exit_kvs['ReturnValue'] = pps ret
66
- end
49
+ exit_kvs = {}
50
+ exit_kvs['Language'] = 'ruby'
51
+ exit_kvs['ProfileName'] = '#{profile_name}'
52
+ exit_kvs['ReturnValue'] = Oboe::API.pps(ret) if #{store_return}
67
53
 
68
- Oboe::Context.log(nil, 'profile_exit', exit_kvs)
54
+ Oboe::Context.log(nil, 'profile_exit', exit_kvs)
55
+ ret
56
+ end"
57
+ rescue Exception => e
58
+ Oboe.logger.warn "[oboe/warn] profile_method: #{e.inspect}"
59
+ end
69
60
 
70
- ret
71
- end"
72
- class_eval code, __FILE__, __LINE__
73
- alias_method "_oboe_orig_#{method_name}", method_name
74
- alias_method method_name, "_oboe_profiled_#{method_name}"
61
+ begin
62
+ class_eval code, __FILE__, __LINE__
63
+ alias_method "_oboe_orig_#{method_name}", method_name
64
+ alias_method method_name, "_oboe_profiled_#{method_name}"
65
+ rescue Exception => e
66
+ Oboe.logger.warn "[oboe/warn] Fatal error profiling method (#{method_name}): #{e.inspect}" if Oboe::Config[:verbose]
67
+ end
75
68
  end
76
69
  end
77
70
  end