oboe 1.4.2.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/lib/oboe/inst/resque.rb
CHANGED
@@ -147,7 +147,7 @@ module Oboe
|
|
147
147
|
end
|
148
148
|
|
149
149
|
if defined?(::Resque)
|
150
|
-
|
150
|
+
Oboe.logger.info "[oboe/loading] Instrumenting resque" if Oboe::Config[:verbose]
|
151
151
|
|
152
152
|
::Resque.module_eval do
|
153
153
|
include Oboe::Inst::Resque
|
@@ -157,7 +157,7 @@ if defined?(::Resque)
|
|
157
157
|
module_eval "alias #{m}_without_oboe #{m}"
|
158
158
|
module_eval "alias #{m} #{m}_with_oboe"
|
159
159
|
elsif Oboe::Config[:verbose]
|
160
|
-
|
160
|
+
Oboe.logger.warn "[oboe/loading] Couldn't properly instrument Resque (#{m}). Partial traces may occur."
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -170,7 +170,7 @@ if defined?(::Resque)
|
|
170
170
|
alias perform_without_oboe perform
|
171
171
|
alias perform perform_with_oboe
|
172
172
|
elsif Oboe::Config[:verbose]
|
173
|
-
|
173
|
+
Oboe.logger.warn "[oboe/loading] Couldn't properly instrument ResqueWorker (perform). Partial traces may occur."
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
@@ -183,7 +183,7 @@ if defined?(::Resque)
|
|
183
183
|
alias fail_without_oboe fail
|
184
184
|
alias fail fail_with_oboe
|
185
185
|
elsif Oboe::Config[:verbose]
|
186
|
-
|
186
|
+
Oboe.logger.warn "[oboe/loading] Couldn't properly instrument ResqueWorker (fail). Partial traces may occur."
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
data/lib/oboe/instrumentation.rb
CHANGED
data/lib/oboe/loading.rb
CHANGED
@@ -24,6 +24,11 @@ module Oboe
|
|
24
24
|
end
|
25
25
|
|
26
26
|
module Loading
|
27
|
+
def self.setup_logger
|
28
|
+
if defined?(::Rails) and ::Rails.logger
|
29
|
+
Oboe.logger = ::Rails.logger
|
30
|
+
end
|
31
|
+
end
|
27
32
|
|
28
33
|
def self.load_access_key
|
29
34
|
unless Oboe::Config.access_key
|
@@ -40,7 +45,7 @@ module Oboe
|
|
40
45
|
end
|
41
46
|
end
|
42
47
|
rescue
|
43
|
-
|
48
|
+
Oboe.logger.error "Having trouble parsing #{config_file}..."
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|
@@ -57,7 +62,7 @@ module Oboe
|
|
57
62
|
begin
|
58
63
|
Oboe::API.extend_with_tracing
|
59
64
|
rescue LoadError => e
|
60
|
-
|
65
|
+
Oboe.logger.fatal "[oboe/error] Couldn't load oboe api."
|
61
66
|
end
|
62
67
|
|
63
68
|
require 'oboe/config'
|
@@ -69,7 +74,7 @@ module Oboe
|
|
69
74
|
begin
|
70
75
|
require f
|
71
76
|
rescue => e
|
72
|
-
|
77
|
+
Oboe.logger.error "[oboe/loading] Error loading framework file '#{f}' : #{e}"
|
73
78
|
end
|
74
79
|
end
|
75
80
|
end
|
data/lib/oboe/logger.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2013 by AppNeta
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
module Oboe
|
5
|
+
class << self
|
6
|
+
attr_accessor :logger
|
7
|
+
end
|
8
|
+
|
9
|
+
class Logger
|
10
|
+
# Fatal message
|
11
|
+
def fatal(string, exception = nil)
|
12
|
+
Oboe.logger.fatal(string) if Oboe.logger
|
13
|
+
end
|
14
|
+
|
15
|
+
# Error message
|
16
|
+
def error(msg, exception = nil)
|
17
|
+
Oboe.logger.error(string) if Oboe.logger
|
18
|
+
end
|
19
|
+
|
20
|
+
# Warn message
|
21
|
+
def warn(msg, exception = nil)
|
22
|
+
Oboe.logger.warn(string) if Oboe.logger
|
23
|
+
end
|
24
|
+
|
25
|
+
# Info message
|
26
|
+
def info(msg, exception = nil)
|
27
|
+
Oboe.logger.info(string) if Oboe.logger
|
28
|
+
end
|
29
|
+
|
30
|
+
# Debug message
|
31
|
+
def debug(msg, exception = nil)
|
32
|
+
Oboe.logger.debug(string) if Oboe.logger
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Oboe.logger = Logger.new(STDERR)
|
39
|
+
|
data/lib/oboe/version.rb
CHANGED
data/lib/oboe_metal.rb
CHANGED
@@ -9,33 +9,29 @@ module Oboe_metal
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class Context
|
12
|
-
|
13
|
-
|
14
|
-
evt.addInfo("Layer", layer.to_s)
|
15
|
-
evt.addInfo("Label", label.to_s)
|
12
|
+
class << self
|
13
|
+
attr_accessor :layer_op
|
16
14
|
|
17
|
-
options
|
18
|
-
evt.
|
19
|
-
|
15
|
+
def log(layer, label, options = {}, with_backtrace = true)
|
16
|
+
evt = Oboe::Context.createEvent()
|
17
|
+
evt.addInfo("Layer", layer.to_s)
|
18
|
+
evt.addInfo("Label", label.to_s)
|
20
19
|
|
21
|
-
|
20
|
+
options.each_pair do |k, v|
|
21
|
+
evt.addInfo(k.to_s, v.to_s)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
end
|
24
|
+
evt.addInfo("Backtrace", Oboe::API.backtrace) if with_backtrace
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.layer_op
|
31
|
-
@layer_op
|
32
|
-
end
|
26
|
+
Oboe.reporter.sendReport(evt)
|
27
|
+
end
|
33
28
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
29
|
+
def tracing_layer_op?(operation)
|
30
|
+
if operation.is_a?(Array)
|
31
|
+
return operation.include?(@layer_op)
|
32
|
+
else
|
33
|
+
return @layer_op == operation
|
34
|
+
end
|
39
35
|
end
|
40
36
|
end
|
41
37
|
end
|
@@ -50,13 +46,57 @@ end
|
|
50
46
|
module Oboe
|
51
47
|
include Oboe_metal
|
52
48
|
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
class << self
|
50
|
+
attr_accessor :reporter
|
51
|
+
|
52
|
+
def always?
|
53
|
+
Oboe::Config[:tracing_mode].to_s == "always"
|
54
|
+
end
|
55
|
+
|
56
|
+
def continue?
|
57
|
+
Oboe::Context.isValid and not Oboe.never?
|
58
|
+
end
|
59
|
+
|
60
|
+
def log(layer, label, options = {})
|
61
|
+
Context.log(layer, label, options = options)
|
62
|
+
end
|
63
|
+
|
64
|
+
def never?
|
65
|
+
Oboe::Config[:tracing_mode].to_s == "never"
|
66
|
+
end
|
67
|
+
|
68
|
+
def now?
|
69
|
+
Oboe::Context.isValid and not Oboe.never?
|
70
|
+
end
|
71
|
+
|
72
|
+
def passthrough?
|
73
|
+
["always", "through"].include?(Oboe::Config[:tracing_mode])
|
74
|
+
end
|
75
|
+
|
76
|
+
def sample?
|
77
|
+
Oboe::Config[:sample_rate].to_i < rand(1e6)
|
78
|
+
end
|
79
|
+
|
80
|
+
def start?
|
81
|
+
not Oboe::Context.isValid and Oboe.always?
|
82
|
+
end
|
83
|
+
|
84
|
+
def through?
|
85
|
+
Oboe::Config[:tracing_mode] == "through"
|
86
|
+
end
|
87
|
+
|
88
|
+
def tracing?
|
89
|
+
Oboe::Context.isValid and not Oboe.never?
|
56
90
|
end
|
57
|
-
return @reporter
|
58
91
|
end
|
59
92
|
end
|
60
93
|
|
61
|
-
|
94
|
+
begin
|
95
|
+
Oboe_metal::Context.init()
|
96
|
+
Oboe.reporter = Oboe::UdpReporter.new("127.0.0.1")
|
97
|
+
|
98
|
+
rescue Exception => e
|
99
|
+
$stderr.puts e.message
|
100
|
+
raise
|
101
|
+
end
|
62
102
|
|
data/oboe.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "oboe/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = %q{oboe}
|
6
|
+
s.version = Oboe::Version::STRING
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
+
s.authors = ["Tracelytics, Inc."]
|
9
|
+
s.email = %q{contact@tracelytics.com}
|
10
|
+
s.summary = %q{Tracelytics instrumentation gem}
|
11
|
+
s.homepage = %q{http://tracelytics.com}
|
12
|
+
s.description = %q{The oboe gem provides AppNeta instrumentation for Ruby and Ruby frameworks.}
|
13
|
+
s.extra_rdoc_files = ["LICENSE"]
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.extensions = ['ext/oboe_metal/extconf.rb']
|
16
|
+
s.test_files = Dir.glob("{spec}/**/*.rb")
|
17
|
+
s.add_development_dependency 'rake'
|
18
|
+
s.add_development_dependency 'rspec'
|
19
|
+
end
|
data/oboe_fu.gemspec
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{oboe_fu}
|
3
|
+
s.version = "1.3.0"
|
4
|
+
s.date = %{2012-09-19}
|
5
|
+
s.authors = ["Tracelytics, Inc."]
|
6
|
+
s.email = %q{contact@tracelytics.com}
|
7
|
+
s.summary = %q{(Deprecated) Oboe instrumentation for Ruby frameworks}
|
8
|
+
s.homepage = %q{http://tracelytics.com}
|
9
|
+
s.description = %q{This gem has been replace by the 'oboe' gem. Please update.}
|
10
|
+
s.extra_rdoc_files = ["LICENSE"]
|
11
|
+
s.files = ['lib/oboe_fu.rb'] + ['LICENSE']
|
12
|
+
s.add_dependency('oboe', '= 1.3.0')
|
13
|
+
end
|
data/release.sh
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# for use only when you're ready to push from prod -> rubygems
|
4
|
+
#
|
5
|
+
|
6
|
+
if [ $# -ne 0 ]
|
7
|
+
then
|
8
|
+
echo -e "Usage: `basename $0`"
|
9
|
+
echo -e "-Summary-"
|
10
|
+
echo -e "\t This script will help you build and release a new version of the oboe Ruby gem."
|
11
|
+
echo -e "\t It will also create a git tag with the version being released."
|
12
|
+
echo -e ""
|
13
|
+
echo -e "-Steps-"
|
14
|
+
echo -e "\t 1. Update lib/oboe/version.rb with the new version you wish to release."
|
15
|
+
echo -e "\t 2. Re-run this script without any arguments."
|
16
|
+
echo -e ""
|
17
|
+
echo -e "-Notes-"
|
18
|
+
echo -e "\t You must have ~/.gem/credentials setup with the Appneta API key for Rubygems."
|
19
|
+
echo -e "\t The API key should be titled :rubygems_appneta: in the credentials file."
|
20
|
+
echo -e ""
|
21
|
+
echo -e "\t Gems with letters in the build number (e.g. pre1 or beta1)will be released "
|
22
|
+
echo -e "\t as a prerelease gem on Rubygems."
|
23
|
+
echo -e ""
|
24
|
+
echo -e "\t See here for an explanation on prelease gems:"
|
25
|
+
echo -e "\t http://guides.rubygems.org/patterns/#prerelease-gems"
|
26
|
+
exit $E_BADARGS
|
27
|
+
fi
|
28
|
+
|
29
|
+
if [ $(git branch -a | grep ^* | awk '{print $2}') != "prod" ]; then
|
30
|
+
echo -e "You can only release gems from prod branch."
|
31
|
+
echo -e "Do a 'git checkout prod' and try again."
|
32
|
+
exit
|
33
|
+
fi
|
34
|
+
|
35
|
+
#set -e # stop on first non-zero exit code
|
36
|
+
#set -x # show commands as they happen
|
37
|
+
|
38
|
+
# Get gem version from lib/oboe/version.rb
|
39
|
+
VERSION=`/usr/bin/env ruby ./get_version.rb`
|
40
|
+
|
41
|
+
read -p "Are you sure you want to release oboe gem version $VERSION to Rubygems? [y/N]" -n 1 -r
|
42
|
+
if [[ $REPLY =~ ^[Yy]$ ]]
|
43
|
+
then
|
44
|
+
echo -e ""
|
45
|
+
|
46
|
+
# tag release (if tag already exists, bails out)
|
47
|
+
echo -e "Creating git tag rel-$VERSION..."
|
48
|
+
if ! git tag rel-$VERSION; then
|
49
|
+
echo -e "Couldn't create tag for ${VERSION}: if it already exists, you need to bump the version."
|
50
|
+
exit
|
51
|
+
fi
|
52
|
+
|
53
|
+
echo -e "Pushing tags to origin (Github)..."
|
54
|
+
git push --tags
|
55
|
+
|
56
|
+
# Build and publish the gem to Rubygems.org
|
57
|
+
echo -e "Building gem..."
|
58
|
+
gem build oboe.gemspec
|
59
|
+
echo -e "Pushing built gem to Rubygems..."
|
60
|
+
gem push -k rubygems_appneta oboe-$VERSION.gem
|
61
|
+
else
|
62
|
+
echo -e ""
|
63
|
+
echo -e "Canceled...nothing done. Have a nice day."
|
64
|
+
fi
|
65
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Oboe::Inst::Cassandra do
|
4
|
+
it 'Stock Cassandra should be loaded, defined and ready' do
|
5
|
+
defined?(::Cassandra).should_not == nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'Cassandra should have oboe methods defined' do
|
9
|
+
[ :insert, :remove, :count_columns, :get_columns, :multi_get_columns, :get,
|
10
|
+
:multi_get, :get_range_single, :get_range_batch, :get_indexed_slices,
|
11
|
+
:create_index, :drop_index, :add_column_family, :drop_column_family,
|
12
|
+
:add_keyspace, :drop_keyspace ].each do |m|
|
13
|
+
::Cassandra.method_defined?("#{m}_with_oboe").should == true
|
14
|
+
end
|
15
|
+
# Special 'exists?' case
|
16
|
+
::Cassandra.method_defined?("exists_with_oboe?").should == true
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Oboe::Inst::Dalli do
|
4
|
+
it 'Stock Dalli should be loaded, defined and ready' do
|
5
|
+
defined?(::Dalli).should_not == nil
|
6
|
+
defined?(::Dalli::Client).should_not == nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'Dalli should have oboe methods defined' do
|
10
|
+
[ :perform_with_oboe, :get_multi_with_oboe ].each do |m|
|
11
|
+
::Dalli::Client.method_defined?(m).should == true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe Oboe::Inst do
|
5
|
+
it 'Net::HTTP should be defined and ready' do
|
6
|
+
defined?(::Net::HTTP).should_not == nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'Net::HTTP should have oboe methods defined' do
|
10
|
+
[ :request_with_oboe ].each do |m|
|
11
|
+
::Net::HTTP.method_defined?(m).should == true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'memcache'
|
3
|
+
|
4
|
+
describe Oboe::API::Memcache do
|
5
|
+
it 'Stock MemCache should be loaded, defined and ready' do
|
6
|
+
defined?(::MemCache).should_not == nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'MemCache should have oboe methods defined' do
|
10
|
+
Oboe::API::Memcache::MEMCACHE_OPS.each do |m|
|
11
|
+
if ::MemCache.method_defined?(m)
|
12
|
+
::MemCache.method_defined?("#{m}_with_oboe").should == true
|
13
|
+
end
|
14
|
+
::MemCache.method_defined?(:request_setup_with_oboe).should == true
|
15
|
+
::MemCache.method_defined?(:cache_get_with_oboe).should == true
|
16
|
+
::MemCache.method_defined?(:get_multi_with_oboe).should == true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if (RUBY_VERSION =~ /^1./) == 0
|
4
|
+
describe Oboe::Inst::Memcached do
|
5
|
+
require 'memcached'
|
6
|
+
require 'memcached/rails'
|
7
|
+
|
8
|
+
it 'Stock Memcached should be loaded, defined and ready' do
|
9
|
+
defined?(::Memcached).should_not == nil
|
10
|
+
defined?(::Memcached::Rails).should_not == nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'Memcached should have oboe methods defined' do
|
14
|
+
Oboe::API::Memcache::MEMCACHE_OPS.each do |m|
|
15
|
+
if ::Memcached.method_defined?(m)
|
16
|
+
::Memcached.method_defined?("#{m}_with_oboe").should == true
|
17
|
+
end
|
18
|
+
::Memcached::Rails.method_defined?(:get_multi_with_oboe).should == true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|