oboe 2.6.5.5 → 2.6.6.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.
- checksums.yaml +4 -4
- data/Gemfile +6 -5
- data/Gemfile.lock +40 -14
- data/README.md +38 -6
- data/Rakefile +4 -4
- data/lib/joboe_metal.rb +1 -1
- data/lib/oboe.rb +4 -3
- data/lib/oboe/frameworks/grape.rb +74 -0
- data/lib/oboe/frameworks/padrino/templates.rb +3 -1
- data/lib/oboe/inst/mongo.rb +23 -23
- data/lib/oboe/instrumentation.rb +1 -1
- data/lib/oboe/util.rb +54 -12
- data/lib/oboe/version.rb +3 -3
- data/lib/oboe_metal.rb +1 -1
- data/lib/rails/generators/oboe/install_generator.rb +3 -3
- data/lib/rails/generators/oboe/templates/oboe_initializer.rb +10 -10
- data/test/frameworks/apps/grape_simple.rb +12 -0
- data/test/frameworks/grape_test.rb +27 -0
- data/test/instrumentation/dalli_test.rb +36 -29
- data/test/instrumentation/memcache_test.rb +52 -52
- data/test/instrumentation/memcached_test.rb +49 -41
- data/test/instrumentation/mongo_test.rb +91 -45
- data/test/instrumentation/rack_test.rb +7 -6
- metadata +29 -24
data/lib/oboe/instrumentation.rb
CHANGED
data/lib/oboe/util.rb
CHANGED
@@ -4,13 +4,7 @@
|
|
4
4
|
module Oboe
|
5
5
|
module Util
|
6
6
|
class << self
|
7
|
-
|
8
|
-
# method_alias
|
9
|
-
#
|
10
|
-
# Centralized utility method to alias a method on an arbitrary
|
11
|
-
# class or module.
|
12
|
-
#
|
13
|
-
def method_alias(cls, method, name=nil)
|
7
|
+
def contextual_name(cls)
|
14
8
|
# Attempt to infer a contextual name if not indicated
|
15
9
|
#
|
16
10
|
# For example:
|
@@ -18,21 +12,31 @@ module Oboe
|
|
18
12
|
# => "AbstractMysqlAdapter"
|
19
13
|
#
|
20
14
|
begin
|
21
|
-
|
15
|
+
cls.to_s.split(/::/).last
|
22
16
|
rescue
|
23
17
|
end
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# method_alias
|
22
|
+
#
|
23
|
+
# Centralized utility method to alias a method on an arbitrary
|
24
|
+
# class or module.
|
25
|
+
#
|
26
|
+
def method_alias(cls, method, name=nil)
|
27
|
+
name ||= contextual_name(cls)
|
24
28
|
|
25
29
|
if cls.method_defined? method.to_sym or cls.private_method_defined? method.to_sym
|
26
|
-
|
30
|
+
|
27
31
|
# Strip '!' or '?' from method if present
|
28
32
|
safe_method_name = method.to_s.chop if method.to_s =~ /\?$|\!$/
|
29
33
|
safe_method_name ||= method
|
30
34
|
|
31
35
|
without_oboe = "#{safe_method_name}_without_oboe"
|
32
36
|
with_oboe = "#{safe_method_name}_with_oboe"
|
33
|
-
|
37
|
+
|
34
38
|
# Only alias if we haven't done so already
|
35
|
-
unless cls.method_defined? without_oboe.to_sym or
|
39
|
+
unless cls.method_defined? without_oboe.to_sym or
|
36
40
|
cls.private_method_defined? without_oboe.to_sym
|
37
41
|
|
38
42
|
cls.class_eval do
|
@@ -43,7 +47,45 @@ module Oboe
|
|
43
47
|
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument #{name}. Partial traces may occur."
|
44
48
|
end
|
45
49
|
end
|
46
|
-
|
50
|
+
|
51
|
+
##
|
52
|
+
# class_method_alias
|
53
|
+
#
|
54
|
+
# Centralized utility method to alias a class method on an arbitrary
|
55
|
+
# class or module
|
56
|
+
#
|
57
|
+
def class_method_alias(cls, method, name=nil)
|
58
|
+
name ||= contextual_name(cls)
|
59
|
+
|
60
|
+
if cls.singleton_methods.include? method.to_sym
|
61
|
+
|
62
|
+
# Strip '!' or '?' from method if present
|
63
|
+
safe_method_name = method.to_s.chop if method.to_s =~ /\?$|\!$/
|
64
|
+
safe_method_name ||= method
|
65
|
+
|
66
|
+
without_oboe = "#{safe_method_name}_without_oboe"
|
67
|
+
with_oboe = "#{safe_method_name}_with_oboe"
|
68
|
+
|
69
|
+
# Only alias if we haven't done so already
|
70
|
+
unless cls.singleton_methods.include? without_oboe.to_sym
|
71
|
+
cls.singleton_class.send(:alias_method, without_oboe, "#{method}")
|
72
|
+
cls.singleton_class.send(:alias_method, "#{method}", with_oboe)
|
73
|
+
end
|
74
|
+
else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument #{name}. Partial traces may occur."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# send_extend
|
80
|
+
#
|
81
|
+
# Centralized utility method to send an extend call for an
|
82
|
+
# arbitrary class
|
83
|
+
def send_extend(target_cls, cls)
|
84
|
+
if defined?(target_cls)
|
85
|
+
target_cls.send(:extend, cls)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
47
89
|
##
|
48
90
|
# send_include
|
49
91
|
#
|
data/lib/oboe/version.rb
CHANGED
data/lib/oboe_metal.rb
CHANGED
@@ -56,7 +56,7 @@ module Oboe_metal
|
|
56
56
|
|
57
57
|
# Only report __Init from here if we are not instrumenting a framework.
|
58
58
|
# Otherwise, frameworks will handle reporting __Init after full initialization
|
59
|
-
unless defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino)
|
59
|
+
unless defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino) or defined?(::Grape)
|
60
60
|
Oboe::API.report_init
|
61
61
|
end
|
62
62
|
|
@@ -22,7 +22,7 @@ module Oboe
|
|
22
22
|
|
23
23
|
break if user_tracing_mode.blank?
|
24
24
|
valid = ['always', 'through', 'never'].include?(user_tracing_mode)
|
25
|
-
|
25
|
+
|
26
26
|
say shell.set_color "Valid values are 'always', 'through' or 'never'", :red, :bold unless valid
|
27
27
|
if valid
|
28
28
|
@tracing_mode = user_tracing_mode
|
@@ -47,10 +47,10 @@ module Oboe
|
|
47
47
|
say "-------------------"
|
48
48
|
say ""
|
49
49
|
say "Details on configuring your sample rate:"
|
50
|
-
say "
|
50
|
+
say "https://support.appneta.com/cloud/configuring-sampling"
|
51
51
|
say ""
|
52
52
|
say "More information on instrumenting Ruby applications can be found here:"
|
53
|
-
say "
|
53
|
+
say "https://support.appneta.com/cloud/installing-ruby-instrumentation"
|
54
54
|
end
|
55
55
|
|
56
56
|
def print_body
|
@@ -2,22 +2,22 @@
|
|
2
2
|
# http://www.appneta.com/products/traceview/
|
3
3
|
#
|
4
4
|
# Details on configuring your sample rate:
|
5
|
-
#
|
5
|
+
# https://support.appneta.com/cloud/configuring-sampling
|
6
6
|
#
|
7
7
|
# More information on instrumenting Ruby applications can be found here:
|
8
|
-
#
|
8
|
+
# https://support.appneta.com/cloud/installing-ruby-instrumentation
|
9
9
|
|
10
|
-
if defined?(Oboe::Config)
|
10
|
+
if defined?(Oboe::Config)
|
11
11
|
# Tracing Mode determines when traces should be initiated for incoming requests. Valid
|
12
12
|
# options are always, through (when using an instrumented Apache or Nginx) and never.
|
13
13
|
#
|
14
14
|
# If you're not using an instrumented Apache or Nginx, set this directive to always in
|
15
15
|
# order to initiate tracing from Ruby.
|
16
16
|
Oboe::Config[:tracing_mode] = '<%= @tracing_mode %>'
|
17
|
-
|
17
|
+
|
18
18
|
# sample_rate is a value from 0 - 1m indicating the fraction of requests per million to trace
|
19
19
|
# Oboe::Config[:sample_rate] = <%= @sample_rate %>
|
20
|
-
|
20
|
+
|
21
21
|
# Verbose output of instrumentation initialization
|
22
22
|
# Oboe::Config[:verbose] = <%= @verbose %>
|
23
23
|
|
@@ -25,8 +25,8 @@ if defined?(Oboe::Config)
|
|
25
25
|
# Resque Options
|
26
26
|
#
|
27
27
|
# :link_workers - associates Resque enqueue operations with the jobs they queue by piggybacking
|
28
|
-
# an additional argument on the Redis queue that is stripped prior to job
|
29
|
-
# processing
|
28
|
+
# an additional argument on the Redis queue that is stripped prior to job
|
29
|
+
# processing
|
30
30
|
# !!! Note: Make sure both the enqueue side and the Resque workers are instrumented
|
31
31
|
# before enabling this or jobs will fail !!!
|
32
32
|
# (Default: false)
|
@@ -34,7 +34,7 @@ if defined?(Oboe::Config)
|
|
34
34
|
#
|
35
35
|
# Set to true to disable Resque argument logging (Default: false)
|
36
36
|
# Oboe::Config[:resque][:log_args] = false
|
37
|
-
|
37
|
+
|
38
38
|
# The oboe Ruby client has the ability to sanitize query literals
|
39
39
|
# from SQL statements. By default this is disabled. Enable to
|
40
40
|
# avoid collecting and reporting query literals to TraceView.
|
@@ -59,14 +59,14 @@ if defined?(Oboe::Config)
|
|
59
59
|
# Oboe::Config[:nethttp][:enabled] = true
|
60
60
|
# Oboe::Config[:redis][:enabled] = true
|
61
61
|
# Oboe::Config[:resque][:enabled] = true
|
62
|
-
|
62
|
+
|
63
63
|
#
|
64
64
|
# Enabling/Disabling Backtrace Collection
|
65
65
|
#
|
66
66
|
# Instrumentation can optionally collect backtraces as they collect
|
67
67
|
# performance metrics. Note that this has a negative impact on
|
68
68
|
# performance but can be useful when trying to locate the source of
|
69
|
-
# a certain call or operation.
|
69
|
+
# a certain call or operation.
|
70
70
|
#
|
71
71
|
# Oboe::Config[:action_controller][:collect_backtraces] = true
|
72
72
|
# Oboe::Config[:active_record][:collect_backtraces] = true
|
@@ -0,0 +1,27 @@
|
|
1
|
+
if RUBY_VERSION >= '1.9.3'
|
2
|
+
require 'minitest_helper'
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/apps/grape_simple')
|
4
|
+
|
5
|
+
describe Grape do
|
6
|
+
before do
|
7
|
+
clear_all_traces
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should trace a request to a simple grape stack" do
|
11
|
+
@app = GrapeSimple
|
12
|
+
|
13
|
+
r = get "/json_endpoint"
|
14
|
+
|
15
|
+
traces = get_all_traces
|
16
|
+
traces.count.must_equal 5
|
17
|
+
|
18
|
+
validate_outer_layers(traces, 'rack')
|
19
|
+
|
20
|
+
traces[1]['Layer'].must_equal "grape"
|
21
|
+
traces[2]['Layer'].must_equal "grape"
|
22
|
+
traces[2].has_key?('Controller').must_equal true
|
23
|
+
traces[2].has_key?('Action').must_equal true
|
24
|
+
traces[3]['Label'].must_equal "info"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,7 +2,7 @@ require 'minitest_helper'
|
|
2
2
|
|
3
3
|
describe Oboe::Inst::Dalli do
|
4
4
|
before do
|
5
|
-
clear_all_traces
|
5
|
+
clear_all_traces
|
6
6
|
@dc = Dalli::Client.new
|
7
7
|
@collect_backtraces = Oboe::Config[:dalli][:collect_backtraces]
|
8
8
|
end
|
@@ -12,7 +12,7 @@ describe Oboe::Inst::Dalli do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'Stock Dalli should be loaded, defined and ready' do
|
15
|
-
defined?(::Dalli).wont_match nil
|
15
|
+
defined?(::Dalli).wont_match nil
|
16
16
|
defined?(::Dalli::Client).wont_match nil
|
17
17
|
end
|
18
18
|
|
@@ -24,11 +24,11 @@ describe Oboe::Inst::Dalli do
|
|
24
24
|
|
25
25
|
it 'should trace set' do
|
26
26
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
27
|
-
@dc.
|
27
|
+
@dc.set('some_key', 1234)
|
28
28
|
end
|
29
29
|
|
30
30
|
traces = get_all_traces
|
31
|
-
traces.count.must_equal
|
31
|
+
traces.count.must_equal 4
|
32
32
|
|
33
33
|
validate_outer_layers(traces, 'dalli_test')
|
34
34
|
|
@@ -36,37 +36,35 @@ describe Oboe::Inst::Dalli do
|
|
36
36
|
traces[1].has_key?("KVKey").must_equal true
|
37
37
|
traces[1]['Layer'].must_equal "memcache"
|
38
38
|
traces[1]['KVKey'].must_equal "some_key"
|
39
|
-
|
40
|
-
traces[2]['Layer'].must_equal "memcache"
|
41
|
-
traces[2]['Label'].must_equal "info"
|
42
|
-
traces[2].has_key?('KVHit')
|
43
39
|
end
|
44
40
|
|
45
41
|
it 'should trace get' do
|
46
42
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
47
|
-
@dc.
|
43
|
+
@dc.get('some_key')
|
48
44
|
end
|
49
|
-
|
45
|
+
|
50
46
|
traces = get_all_traces
|
51
|
-
traces.count.must_equal
|
52
|
-
|
47
|
+
traces.count.must_equal 5
|
48
|
+
|
53
49
|
validate_outer_layers(traces, 'dalli_test')
|
54
50
|
|
55
|
-
traces[1]['KVOp'].must_equal "
|
51
|
+
traces[1]['KVOp'].must_equal "get"
|
56
52
|
traces[1]['KVKey'].must_equal "some_key"
|
57
|
-
traces[2]['Label'].must_equal "
|
53
|
+
traces[2]['Label'].must_equal "info"
|
54
|
+
traces[2].has_key?('KVHit').must_equal true
|
55
|
+
traces[3]['Label'].must_equal "exit"
|
58
56
|
end
|
59
57
|
|
60
58
|
it 'should trace get_multi' do
|
61
59
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
62
60
|
@dc.get_multi([:one, :two, :three, :four, :five, :six])
|
63
61
|
end
|
64
|
-
|
62
|
+
|
65
63
|
traces = get_all_traces
|
66
64
|
traces.count.must_equal 5
|
67
|
-
|
65
|
+
|
68
66
|
validate_outer_layers(traces, 'dalli_test')
|
69
|
-
|
67
|
+
|
70
68
|
traces[1]['KVOp'].must_equal "get_multi"
|
71
69
|
traces[2]['Label'].must_equal "info"
|
72
70
|
traces[2].has_key?('KVKeyCount').must_equal true
|
@@ -75,55 +73,63 @@ describe Oboe::Inst::Dalli do
|
|
75
73
|
end
|
76
74
|
|
77
75
|
it "should trace increment" do
|
76
|
+
@dc.incr("dalli_key_counter", 1, nil, 0)
|
77
|
+
|
78
78
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
79
|
-
@dc.incr("
|
79
|
+
@dc.incr("dalli_key_counter")
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
traces = get_all_traces
|
83
83
|
traces.count.must_equal 4
|
84
|
-
|
84
|
+
|
85
85
|
validate_outer_layers(traces, 'dalli_test')
|
86
86
|
|
87
87
|
traces[1]['KVOp'].must_equal "incr"
|
88
|
-
traces[1]['KVKey'].must_equal "
|
88
|
+
traces[1]['KVKey'].must_equal "dalli_key_counter"
|
89
89
|
traces[2]['Label'].must_equal "exit"
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should trace decrement" do
|
93
|
+
@dc.incr("dalli_key_counter", 1, nil, 0)
|
94
|
+
|
93
95
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
94
|
-
@dc.decr("
|
96
|
+
@dc.decr("dalli_key_counter")
|
95
97
|
end
|
96
|
-
|
98
|
+
|
97
99
|
traces = get_all_traces
|
98
100
|
traces.count.must_equal 4
|
99
|
-
|
101
|
+
|
100
102
|
validate_outer_layers(traces, 'dalli_test')
|
101
103
|
|
102
104
|
traces[1]['KVOp'].must_equal "decr"
|
103
|
-
traces[1]['KVKey'].must_equal "
|
105
|
+
traces[1]['KVKey'].must_equal "dalli_key_counter"
|
104
106
|
traces[2]['Label'].must_equal "exit"
|
105
107
|
end
|
106
108
|
|
107
109
|
it "should trace replace" do
|
110
|
+
@dc.set('some_key', 1)
|
111
|
+
|
108
112
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
109
113
|
@dc.replace("some_key", "woop")
|
110
114
|
end
|
111
|
-
|
115
|
+
|
112
116
|
traces = get_all_traces
|
113
117
|
traces.count.must_equal 4
|
114
118
|
|
115
119
|
validate_outer_layers(traces, 'dalli_test')
|
116
|
-
|
120
|
+
|
117
121
|
traces[1]['KVOp'].must_equal "replace"
|
118
122
|
traces[1]['KVKey'].must_equal "some_key"
|
119
123
|
traces[2]['Label'].must_equal "exit"
|
120
124
|
end
|
121
125
|
|
122
126
|
it "should trace delete" do
|
127
|
+
@dc.set('some_key', 1)
|
128
|
+
|
123
129
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
124
130
|
@dc.delete("some_key")
|
125
131
|
end
|
126
|
-
|
132
|
+
|
127
133
|
traces = get_all_traces
|
128
134
|
traces.count.must_equal 4
|
129
135
|
|
@@ -132,8 +138,9 @@ describe Oboe::Inst::Dalli do
|
|
132
138
|
traces[1]['KVOp'].must_equal "delete"
|
133
139
|
traces[1]['KVKey'].must_equal "some_key"
|
134
140
|
end
|
135
|
-
|
141
|
+
|
136
142
|
it "should obey :collect_backtraces setting when true" do
|
143
|
+
@dc.set('some_key', 1)
|
137
144
|
Oboe::Config[:dalli][:collect_backtraces] = true
|
138
145
|
|
139
146
|
Oboe::API.start_trace('dalli_test', '', {}) do
|
@@ -3,7 +3,7 @@ require 'memcache'
|
|
3
3
|
|
4
4
|
describe Oboe::API::Memcache do
|
5
5
|
before do
|
6
|
-
clear_all_traces
|
6
|
+
clear_all_traces
|
7
7
|
@mc = ::MemCache.new('localhost')
|
8
8
|
|
9
9
|
# These are standard entry/exit KVs that are passed up with all mongo operations
|
@@ -24,57 +24,57 @@ describe Oboe::API::Memcache do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'Stock MemCache should be loaded, defined and ready' do
|
27
|
-
defined?(::MemCache).wont_match nil
|
27
|
+
defined?(::MemCache).wont_match nil
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'MemCache should have oboe methods defined' do
|
31
31
|
Oboe::API::Memcache::MEMCACHE_OPS.each do |m|
|
32
32
|
if ::MemCache.method_defined?(m)
|
33
|
-
::MemCache.method_defined?("#{m}_with_oboe").must_equal true
|
33
|
+
::MemCache.method_defined?("#{m}_with_oboe").must_equal true
|
34
34
|
end
|
35
|
-
::MemCache.method_defined?(:request_setup_with_oboe).must_equal true
|
36
|
-
::MemCache.method_defined?(:cache_get_with_oboe).must_equal true
|
37
|
-
::MemCache.method_defined?(:get_multi_with_oboe).must_equal true
|
35
|
+
::MemCache.method_defined?(:request_setup_with_oboe).must_equal true
|
36
|
+
::MemCache.method_defined?(:cache_get_with_oboe).must_equal true
|
37
|
+
::MemCache.method_defined?(:get_multi_with_oboe).must_equal true
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
it "should trace set" do
|
42
42
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
43
43
|
@mc.set('msg', 'blah')
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
traces = get_all_traces
|
47
47
|
|
48
48
|
traces.count.must_equal 5
|
49
49
|
validate_outer_layers(traces, 'memcache_test')
|
50
50
|
|
51
51
|
validate_event_keys(traces[1], @entry_kvs)
|
52
|
-
|
52
|
+
|
53
53
|
traces[1]['KVOp'].must_equal "set"
|
54
54
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
55
|
-
|
55
|
+
|
56
56
|
validate_event_keys(traces[2], @info_kvs)
|
57
57
|
traces[2]['KVKey'].must_equal "msg"
|
58
58
|
traces[2].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
59
59
|
|
60
60
|
validate_event_keys(traces[3], @exit_kvs)
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
it "should trace get" do
|
64
64
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
65
65
|
@mc.get('msg')
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
traces = get_all_traces
|
69
|
-
|
69
|
+
|
70
70
|
traces.count.must_equal 6
|
71
71
|
validate_outer_layers(traces, 'memcache_test')
|
72
72
|
|
73
73
|
validate_event_keys(traces[1], @entry_kvs)
|
74
|
-
|
74
|
+
|
75
75
|
traces[1]['KVOp'].must_equal "get"
|
76
76
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
77
|
-
|
77
|
+
|
78
78
|
validate_event_keys(traces[2], @info_kvs)
|
79
79
|
traces[2]['KVKey'].must_equal "msg"
|
80
80
|
traces[2]['RemoteHost'].must_equal "localhost"
|
@@ -85,21 +85,21 @@ describe Oboe::API::Memcache do
|
|
85
85
|
|
86
86
|
validate_event_keys(traces[4], @exit_kvs)
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it "should trace get_multi" do
|
90
90
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
91
91
|
@mc.get_multi(['one', 'two', 'three', 'four', 'five', 'six'])
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
traces = get_all_traces
|
95
|
-
|
95
|
+
|
96
96
|
traces.count.must_equal 5
|
97
97
|
validate_outer_layers(traces, 'memcache_test')
|
98
98
|
|
99
99
|
validate_event_keys(traces[1], @entry_kvs)
|
100
|
-
|
100
|
+
|
101
101
|
traces[1]['KVOp'].must_equal "get_multi"
|
102
|
-
|
102
|
+
|
103
103
|
validate_event_keys(traces[2], @info_kvs)
|
104
104
|
traces[2]['KVKeyCount'].must_equal "6"
|
105
105
|
traces[2].has_key?('KVHitCount').must_equal true
|
@@ -107,88 +107,88 @@ describe Oboe::API::Memcache do
|
|
107
107
|
|
108
108
|
validate_event_keys(traces[3], @exit_kvs)
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
it "should trace add for existing key" do
|
112
112
|
@mc.set('testKey', 'x', 1200)
|
113
113
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
114
114
|
@mc.add('testKey', 'x', 1200)
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
traces = get_all_traces
|
118
|
-
|
118
|
+
|
119
119
|
traces.count.must_equal 5
|
120
120
|
validate_outer_layers(traces, 'memcache_test')
|
121
121
|
|
122
122
|
validate_event_keys(traces[1], @entry_kvs)
|
123
|
-
|
123
|
+
|
124
124
|
traces[1]['KVOp'].must_equal "add"
|
125
125
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
126
|
-
|
126
|
+
|
127
127
|
validate_event_keys(traces[2], @info_kvs)
|
128
128
|
traces[2]['KVKey'].must_equal "testKey"
|
129
|
-
|
129
|
+
|
130
130
|
validate_event_keys(traces[3], @exit_kvs)
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
it "should trace append" do
|
134
134
|
@mc.set('rawKey', "Peanut Butter ", 600, :raw => true)
|
135
135
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
136
136
|
@mc.append('rawKey', "Jelly")
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
traces = get_all_traces
|
140
|
-
|
140
|
+
|
141
141
|
traces.count.must_equal 5
|
142
142
|
validate_outer_layers(traces, 'memcache_test')
|
143
143
|
|
144
144
|
validate_event_keys(traces[1], @entry_kvs)
|
145
|
-
|
145
|
+
|
146
146
|
traces[1]['KVOp'].must_equal "append"
|
147
147
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
148
|
-
|
148
|
+
|
149
149
|
validate_event_keys(traces[2], @info_kvs)
|
150
|
-
|
150
|
+
|
151
151
|
traces[2]['KVKey'].must_equal "rawKey"
|
152
152
|
traces[2].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
153
|
-
|
153
|
+
|
154
154
|
validate_event_keys(traces[3], @exit_kvs)
|
155
155
|
end
|
156
|
-
|
157
|
-
it "should trace
|
156
|
+
|
157
|
+
it "should trace decrement" do
|
158
158
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
159
|
-
@mc.decr('
|
159
|
+
@mc.decr('memcache_key_counter', 1)
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
traces = get_all_traces
|
163
|
-
|
163
|
+
|
164
164
|
traces.count.must_equal 5
|
165
165
|
validate_outer_layers(traces, 'memcache_test')
|
166
166
|
|
167
167
|
validate_event_keys(traces[1], @entry_kvs)
|
168
|
-
|
168
|
+
|
169
169
|
traces[1]['KVOp'].must_equal "decr"
|
170
170
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
171
|
-
|
172
|
-
traces[2]['KVKey'].must_equal "
|
171
|
+
|
172
|
+
traces[2]['KVKey'].must_equal "memcache_key_counter"
|
173
173
|
traces[2].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
|
174
|
-
|
174
|
+
|
175
175
|
validate_event_keys(traces[3], @exit_kvs)
|
176
176
|
end
|
177
177
|
|
178
178
|
it "should trace increment" do
|
179
179
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
180
|
-
@mc.incr("
|
180
|
+
@mc.incr("memcache_key_counter", 1)
|
181
181
|
end
|
182
|
-
|
182
|
+
|
183
183
|
traces = get_all_traces
|
184
|
-
|
184
|
+
|
185
185
|
traces.count.must_equal 5
|
186
186
|
validate_outer_layers(traces, 'memcache_test')
|
187
|
-
|
187
|
+
|
188
188
|
validate_event_keys(traces[1], @entry_kvs)
|
189
189
|
traces[1]['KVOp'].must_equal "incr"
|
190
190
|
validate_event_keys(traces[2], @info_kvs)
|
191
|
-
traces[2]['KVKey'].must_equal "
|
191
|
+
traces[2]['KVKey'].must_equal "memcache_key_counter"
|
192
192
|
validate_event_keys(traces[3], @exit_kvs)
|
193
193
|
end
|
194
194
|
|
@@ -197,9 +197,9 @@ describe Oboe::API::Memcache do
|
|
197
197
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
198
198
|
@mc.replace("some_key", "woop")
|
199
199
|
end
|
200
|
-
|
200
|
+
|
201
201
|
traces = get_all_traces
|
202
|
-
|
202
|
+
|
203
203
|
traces.count.must_equal 5
|
204
204
|
validate_outer_layers(traces, 'memcache_test')
|
205
205
|
|
@@ -214,9 +214,9 @@ describe Oboe::API::Memcache do
|
|
214
214
|
Oboe::API.start_trace('memcache_test', '', {}) do
|
215
215
|
@mc.delete("some_key")
|
216
216
|
end
|
217
|
-
|
217
|
+
|
218
218
|
traces = get_all_traces
|
219
|
-
|
219
|
+
|
220
220
|
traces.count.must_equal 5
|
221
221
|
validate_outer_layers(traces, 'memcache_test')
|
222
222
|
|
@@ -226,7 +226,7 @@ describe Oboe::API::Memcache do
|
|
226
226
|
validate_event_keys(traces[2], @info_kvs)
|
227
227
|
validate_event_keys(traces[3], @exit_kvs)
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
it "should obey :collect_backtraces setting when true" do
|
231
231
|
Oboe::Config[:memcache][:collect_backtraces] = true
|
232
232
|
|