oboe 1.4.2.2 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +103 -0
- data/Guardfile +24 -0
- data/README.md +36 -0
- data/Rakefile +12 -0
- data/ext/oboe_metal/extconf.rb +12 -4
- data/ext/oboe_metal/tests/test.rb +7 -0
- data/get_version.rb +5 -0
- data/lib/joboe_metal.rb +45 -0
- data/lib/oboe.rb +16 -7
- data/lib/oboe/api/logging.rb +1 -1
- data/lib/oboe/api/tracing.rb +1 -1
- data/lib/oboe/api/util.rb +1 -1
- data/lib/oboe/config.rb +0 -47
- data/lib/oboe/frameworks/rails.rb +9 -7
- data/lib/oboe/frameworks/rails/inst/action_controller.rb +1 -1
- data/lib/oboe/frameworks/rails/inst/action_view.rb +8 -8
- data/lib/oboe/frameworks/rails/inst/active_record.rb +18 -18
- data/lib/oboe/inst/cassandra.rb +3 -3
- data/lib/oboe/inst/dalli.rb +2 -2
- data/lib/oboe/inst/http.rb +1 -1
- data/lib/oboe/inst/memcache.rb +4 -4
- data/lib/oboe/inst/memcached.rb +2 -2
- data/lib/oboe/inst/mongo.rb +1 -1
- data/lib/oboe/inst/moped.rb +5 -5
- data/lib/oboe/inst/resque.rb +4 -4
- data/lib/oboe/instrumentation.rb +1 -1
- data/lib/oboe/loading.rb +8 -3
- data/lib/oboe/logger.rb +39 -0
- data/lib/oboe/version.rb +4 -4
- data/lib/oboe_metal.rb +67 -27
- data/oboe.gemspec +19 -0
- data/oboe_fu.gemspec +13 -0
- data/release.sh +65 -0
- data/spec/instrumentation/cassandra_spec.rb +18 -0
- data/spec/instrumentation/dalli_spec.rb +14 -0
- data/spec/instrumentation/http_spec.rb +14 -0
- data/spec/instrumentation/memcache_spec.rb +19 -0
- data/spec/instrumentation/memcached_spec.rb +22 -0
- data/spec/instrumentation/mongo_spec.rb +29 -0
- data/spec/instrumentation/moped_spec.rb +41 -0
- data/spec/instrumentation/resque_spec.rb +18 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/config_spec.rb +27 -0
- data/spec/support/oboe_spec.rb +4 -0
- metadata +100 -41
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Import dependencies from oboe.gemspec
|
4
|
+
gemspec :name => 'oboe'
|
5
|
+
|
6
|
+
gem 'rake'
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'guard'
|
10
|
+
gem 'guard-rspec'
|
11
|
+
|
12
|
+
gem 'rb-inotify', :require => false
|
13
|
+
gem 'rb-fsevent', :require => false
|
14
|
+
gem 'rb-fchange', :require => false
|
15
|
+
end
|
16
|
+
|
17
|
+
group :test do
|
18
|
+
gem 'rspec'
|
19
|
+
|
20
|
+
# Instrumented gems
|
21
|
+
gem 'dalli'
|
22
|
+
gem 'memcache-client'
|
23
|
+
gem 'memcached' if (RUBY_VERSION =~ /^1./) == 0
|
24
|
+
gem 'cassandra'
|
25
|
+
gem 'mongo'
|
26
|
+
gem 'bson_ext' # For Mongo, Yours Truly
|
27
|
+
gem 'moped'
|
28
|
+
gem 'resque'
|
29
|
+
end
|
30
|
+
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,103 @@
|
|
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
|
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Tracelytics Ruby (and Ruby Frameworks) Instrumentation
|
2
|
+
|
3
|
+
```oboe``` provides instrumentation for [Ruby](http://www.ruby-lang.org/en/) and the [Rails framework](http://rubyonrails.org/), as well as other
|
4
|
+
common components used to build rails applications.
|
5
|
+
|
6
|
+
## Installing
|
7
|
+
|
8
|
+
See the [Ruby Knowedge Base article](http://support.tracelytics.com/kb/instrumenting-your-app/instrumenting-ruby-apps)
|
9
|
+
for information on how to install. Release notes can be found [here](http://support.tracelytics.com/kb/instrumenting-your-app/ruby-instrumentation-release-notes)
|
10
|
+
|
11
|
+
## Supported Technologies
|
12
|
+
|
13
|
+
Check the [support matrix](https://github.com/tracelytics/oboe-ruby/wiki/Support-Matrix) for which versions of Ruby, Rails and technologies are supported.
|
14
|
+
|
15
|
+
## Tips
|
16
|
+
|
17
|
+
General tips using, installing and debugging the oboe gem can be found [here](https://github.com/tracelytics/oboe-ruby/wiki/Ruby-Oboe-Tips).
|
18
|
+
|
19
|
+
## liboboe Linking Notes
|
20
|
+
|
21
|
+
Build instructions
|
22
|
+
|
23
|
+
- Requires: liboboe development headers, available from the
|
24
|
+
liboboe-dev (Ubuntu) and liboboe-devel (Red Hat) packages.
|
25
|
+
|
26
|
+
Build and install a gem the normal way:
|
27
|
+
|
28
|
+
gem build oboe.gemspec
|
29
|
+
gem install oboe-VERSION.gem
|
30
|
+
|
31
|
+
Compile a binary gem from a regular gem, using gem-compile [1]:
|
32
|
+
|
33
|
+
sudo gem install gem-compile
|
34
|
+
gem compile oboe-VERSION.gem
|
35
|
+
|
36
|
+
[1] https://github.com/frsyuki/gem-compile
|
data/Rakefile
ADDED
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# Copyright (c) 2012 by Tracelytics, Inc.
|
2
2
|
# All rights reserved.
|
3
|
-
|
4
3
|
require 'mkmf'
|
5
4
|
require 'rbconfig'
|
6
5
|
|
7
|
-
dir_config('oboe')
|
8
|
-
|
9
6
|
# Check if we're running in JRuby
|
10
7
|
if RbConfig::CONFIG.has_key?('arch')
|
11
8
|
# nil meaning java string not found
|
@@ -14,7 +11,17 @@ else
|
|
14
11
|
jruby = false
|
15
12
|
end
|
16
13
|
|
17
|
-
|
14
|
+
dir_config('oboe')
|
15
|
+
|
16
|
+
if jruby or ENV.has_key?('TRACEVIEW_URL')
|
17
|
+
# Build the noop extension under JRuby and Heroku.
|
18
|
+
# The oboe-heroku gem builds it's own c extension which links to
|
19
|
+
# libs specific to a Heroku dyno
|
20
|
+
# FIXME: For JRuby we need to remove the c extension entirely
|
21
|
+
create_makefile('oboe_noop', 'noop')
|
22
|
+
|
23
|
+
elsif have_library('oboe')
|
24
|
+
|
18
25
|
$libs = append_library($libs, "oboe")
|
19
26
|
$libs = append_library($libs, "stdc++")
|
20
27
|
|
@@ -24,6 +31,7 @@ if not jruby and have_library('oboe')
|
|
24
31
|
|
25
32
|
cpp_command('g++') if RUBY_VERSION < '1.9'
|
26
33
|
create_makefile('oboe_metal', 'src')
|
34
|
+
|
27
35
|
else
|
28
36
|
$stderr.puts "Error: Could not find the base liboboe libraries. No tracing will occur."
|
29
37
|
create_makefile('oboe_noop', 'noop')
|
data/get_version.rb
ADDED
data/lib/joboe_metal.rb
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
module Oboe_metal
|
5
5
|
include_package 'com.tracelytics.joboe'
|
6
6
|
import 'com.tracelytics.joboe'
|
7
|
+
include_package 'com.tracelytics.joboe.SettingsReader'
|
8
|
+
import 'com.tracelytics.joboe.SettingsReader'
|
7
9
|
include_package 'com.tracelytics.joboe.Context'
|
8
10
|
import 'com.tracelytics.joboe.Context'
|
9
11
|
include_package 'com.tracelytics.joboe.Event'
|
@@ -77,7 +79,50 @@ end
|
|
77
79
|
module Oboe
|
78
80
|
include Oboe_metal
|
79
81
|
|
82
|
+
def self.always?
|
83
|
+
Oboe::Config[:tracing_mode].to_s == "always"
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.continue?
|
87
|
+
Oboe::Context.isValid and not Oboe.never?
|
88
|
+
end
|
89
|
+
|
80
90
|
def self.log(layer, label, options = {})
|
81
91
|
Context.log(layer, label, options = options)
|
82
92
|
end
|
93
|
+
|
94
|
+
def self.never?
|
95
|
+
Oboe::Config[:tracing_mode].to_s == "never"
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.now?
|
99
|
+
Oboe::Context.isValid and not Oboe.never?
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.passthrough?
|
103
|
+
["always", "through"].include?(Oboe::Config[:tracing_mode])
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.sample?
|
107
|
+
Java::ComTracelyticsJoboeSettingsReader.shouldTraceRequest('', '')
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.start?
|
111
|
+
not Oboe::Context.isValid and Oboe.always?
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.through?
|
115
|
+
Oboe::Config[:tracing_mode] == "through"
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.tracing?
|
119
|
+
Oboe::Context.isValid and not Oboe.never?
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.reporter
|
123
|
+
if !@reporter
|
124
|
+
@reporter = Oboe::UdpReporter.new(Oboe::Config[:reporter_host])
|
125
|
+
end
|
126
|
+
return @reporter
|
127
|
+
end
|
83
128
|
end
|
data/lib/oboe.rb
CHANGED
@@ -3,13 +3,20 @@
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'rbconfig'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
require 'logger'
|
7
|
+
|
8
|
+
# If Oboe_metal is already defined then we are in a PaaS environment
|
9
|
+
# with an alternate metal (such as Heroku: see the oboe-heroku gem)
|
10
|
+
unless defined?(Oboe_metal)
|
11
|
+
if RUBY_PLATFORM == 'java'
|
12
|
+
require '/usr/local/tracelytics/tracelyticsagent.jar'
|
13
|
+
require 'joboe_metal'
|
14
|
+
else
|
15
|
+
require 'oboe_metal.so'
|
16
|
+
require 'oboe_metal'
|
17
|
+
end
|
12
18
|
end
|
19
|
+
require 'oboe/logger'
|
13
20
|
require 'oboe/config'
|
14
21
|
require 'oboe/loading'
|
15
22
|
require 'method_profiling'
|
@@ -20,5 +27,7 @@ begin
|
|
20
27
|
require 'oboe/frameworks/rails' if defined?(::Rails)
|
21
28
|
|
22
29
|
rescue LoadError
|
23
|
-
puts "Unsupported Tracelytics environment (no libs). Going No-op."
|
30
|
+
$stderr.puts "Unsupported Tracelytics environment (no libs). Going No-op."
|
31
|
+
rescue Exception => e
|
32
|
+
$stderr.puts "[oboe/error] Problem loading: #{e.inspect}"
|
24
33
|
end
|
data/lib/oboe/api/logging.rb
CHANGED
data/lib/oboe/api/tracing.rb
CHANGED
data/lib/oboe/api/util.rb
CHANGED
data/lib/oboe/config.rb
CHANGED
@@ -2,53 +2,6 @@
|
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
module Oboe
|
5
|
-
|
6
|
-
def self.always?
|
7
|
-
Oboe::Config[:tracing_mode].to_s == "always"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.continue?
|
11
|
-
Oboe::Context.isValid and not Oboe.never?
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.log(layer, label, options = {})
|
15
|
-
Context.log(layer, label, options = options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.never?
|
19
|
-
Oboe::Config[:tracing_mode].to_s == "never"
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.now?
|
23
|
-
Oboe::Context.isValid and not Oboe.never?
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.passthrough?
|
27
|
-
["always", "through"].include?(Oboe::Config[:tracing_mode])
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.sample?
|
31
|
-
# Note that this the only point in the code that currently does and
|
32
|
-
# should ever read the sample rate. When autopilot is released, modify
|
33
|
-
# the line below and that line only.
|
34
|
-
Oboe::Config[:sample_rate].to_i < rand(1e6)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.start?
|
38
|
-
not Oboe::Context.isValid and Oboe.always?
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.through?
|
42
|
-
Oboe::Config[:tracing_mode] == "through"
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.tracing?
|
46
|
-
Oboe::Context.isValid and not Oboe.never?
|
47
|
-
end
|
48
|
-
|
49
|
-
############################
|
50
|
-
# Oboe Configuration Module
|
51
|
-
############################
|
52
5
|
module Config
|
53
6
|
@@config = {}
|
54
7
|
|