oboe 2.7.11.1 → 2.7.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf54d0acc797dc2e44f88be2e6b78343238a3002
4
- data.tar.gz: 8ad6c21adbb5bbf4f2b841b17d68db0535b67f73
3
+ metadata.gz: dfce26e81a5f2b277f2e9f78c53fa1d75b9fdd61
4
+ data.tar.gz: 1429c9511ce4eda6e8a8e98a8dcd7a4769c7ecc0
5
5
  SHA512:
6
- metadata.gz: 9c8280991451e38d92ebe98eeed3e70640a48041bf92102d28e0d14eaf4e7871c356f23150e4df197f09ff37b6e50b4621cc2ba48dd3995873d22172a8a85779
7
- data.tar.gz: fc98cddfe8e2607804b3584c902d0feb45062546a53e57294c5fb613e4ac1b172fe52e1bb6ff6822efc631e1ada4a64486d78ce2a7d0a8670fec5563594c29e8
6
+ metadata.gz: 0c8852cb34616557c3ab272200aa8f74c545f828976e6056678823729f3aa2231f1b98673eb963c3e05db0df9208b52985b40b6d2f216e5c704be9b5d2345705
7
+ data.tar.gz: 0901f4acbde6e5f24f0b10744d4bb12b4bf10eee5464969d23e93f4d874705fbd0d85f463cc36f4a24375426ba8563b2ff82909e206c2a94e79a9916c4a591d4
@@ -181,7 +181,18 @@ module Oboe
181
181
  Oboe.layer = nil if label == 'exit'
182
182
 
183
183
  opts.each do |k, v|
184
- event.addInfo(k.to_s, v.to_s) if valid_key? k
184
+ if valid_key? k
185
+ if [Class, Module, Symbol, Array, Hash,
186
+ TrueClass, FalseClass].include?(v.class)
187
+ value = v.to_s
188
+ elsif v.class == Set
189
+ value = v.to_a.to_s
190
+ else
191
+ value = v
192
+ end
193
+
194
+ event.addInfo(k.to_s, value)
195
+ end
185
196
  end if !opts.nil? && opts.any?
186
197
 
187
198
  Oboe::Reporter.sendReport(event) if Oboe.loaded
@@ -47,6 +47,20 @@ module Oboe
47
47
  end
48
48
 
49
49
  def call(env)
50
+ rack_skipped = false
51
+
52
+ # In the case of nested Ruby apps such as Grape inside of Rails
53
+ # or Grape inside of Grape, each app has it's own instance
54
+ # of rack middleware. We avoid tracing rack more than once and
55
+ # instead start instrumenting from the first rack pass.
56
+
57
+ # If we're already tracing a rack layer, dont't start another one.
58
+ if Oboe.tracing? && Oboe.layer == 'rack'
59
+ rack_skipped = true
60
+ Oboe.logger.debug "[oboe/rack] Rack skipped!"
61
+ return @app.call(env)
62
+ end
63
+
50
64
  req = ::Rack::Request.new(env)
51
65
 
52
66
  report_kvs = {}
@@ -63,21 +77,34 @@ module Oboe
63
77
  Oboe.is_continued_trace = Oboe.has_incoming_context or Oboe.has_xtrace_header
64
78
 
65
79
  Oboe::API.log_start('rack', xtrace_header, report_kvs)
66
- report_kvs = collect(req, env) if Oboe.tracing?
67
-
68
- status, headers, response = @app.call(env)
69
80
 
81
+ # We only trace a subset of requests based off of sample rate so if
82
+ # Oboe::API.log_start really did start a trace, we act accordingly here.
70
83
  if Oboe.tracing?
71
- xtrace = Oboe::API.log_end('rack', report_kvs.merge!(:Status => status))
84
+ report_kvs = collect(req, env)
85
+
86
+ # We log an info event with the HTTP KVs found in Oboe::Rack.collect
87
+ # This is done here so in the case of stacks that try/catch/abort
88
+ # (looking at you Grape) we're sure the KVs get reported now as
89
+ # this code may not be returned to later.
90
+ Oboe::API.log_info('rack', report_kvs)
91
+
92
+ status, headers, response = @app.call(env)
93
+
94
+ xtrace = Oboe::API.log_end('rack', :Status => status)
95
+ else
96
+ status, headers, response = @app.call(env)
72
97
  end
73
98
 
74
99
  [status, headers, response]
75
100
  rescue Exception => e
76
- Oboe::API.log_exception('rack', e)
77
- xtrace = Oboe::API.log_end('rack', report_kvs.merge!(:Status => 500))
101
+ unless rack_skipped
102
+ Oboe::API.log_exception('rack', e)
103
+ xtrace = Oboe::API.log_end('rack', :Status => 500)
104
+ end
78
105
  raise
79
106
  ensure
80
- if headers && Oboe::XTrace.valid?(xtrace)
107
+ if !rack_skipped && headers && Oboe::XTrace.valid?(xtrace)
81
108
  unless defined?(JRUBY_VERSION) && Oboe.is_continued_trace?
82
109
  headers['X-Trace'] = xtrace if headers.is_a?(Hash)
83
110
  end
@@ -8,7 +8,7 @@ module Oboe
8
8
  module Version
9
9
  MAJOR = 2
10
10
  MINOR = 7
11
- PATCH = 11
11
+ PATCH = 12
12
12
  BUILD = 1
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -0,0 +1,30 @@
1
+ require 'grape'
2
+
3
+ class Wrapper < Grape::API
4
+ class GrapeSimple < Grape::API
5
+ rescue_from :all do |e|
6
+ error_response({ message: "rescued from #{e.class.name}" })
7
+ end
8
+
9
+ get '/json_endpoint' do
10
+ present({ :test => true })
11
+ end
12
+
13
+ get "/break" do
14
+ raise Exception.new("This should have http status code 500!")
15
+ end
16
+
17
+ get "/error" do
18
+ error!("This is a error with 'error'!")
19
+ end
20
+
21
+ get "/breakstring" do
22
+ raise "This should have http status code 500!"
23
+ end
24
+ end
25
+ end
26
+
27
+ class GrapeNested < Grape::API
28
+ mount Wrapper::GrapeSimple
29
+ end
30
+
@@ -1,6 +1,7 @@
1
1
  if RUBY_VERSION >= '1.9.3'
2
2
  require 'minitest_helper'
3
3
  require File.expand_path(File.dirname(__FILE__) + '/apps/grape_simple')
4
+ require File.expand_path(File.dirname(__FILE__) + '/apps/grape_nested')
4
5
 
5
6
  describe Grape do
6
7
  before do
@@ -16,21 +17,77 @@ if RUBY_VERSION >= '1.9.3'
16
17
  r.headers.key?('X-Trace').must_equal true
17
18
 
18
19
  traces = get_all_traces
19
- traces.count.must_equal 4
20
+ traces.count.must_equal 5
20
21
 
21
22
  validate_outer_layers(traces, 'rack')
22
23
 
23
- traces[1]['Layer'].must_equal "grape"
24
24
  traces[2]['Layer'].must_equal "grape"
25
- traces[2].has_key?('Controller').must_equal true
26
- traces[2].has_key?('Action').must_equal true
25
+ traces[3]['Layer'].must_equal "grape"
26
+ traces[3].has_key?('Controller').must_equal true
27
+ traces[3].has_key?('Action').must_equal true
28
+ traces[4]['Label'].must_equal "exit"
29
+
30
+ # Validate the existence of the response header
31
+ r.headers.key?('X-Trace').must_equal true
32
+ r.headers['X-Trace'].must_equal traces[4]['X-Trace']
33
+ end
34
+
35
+ it "should trace a request to a nested grape stack" do
36
+ @app = GrapeNested
37
+
38
+ r = get "/json_endpoint"
39
+
40
+ r.status.must_equal 200
41
+ r.headers.key?('X-Trace').must_equal true
42
+
43
+ traces = get_all_traces
44
+ traces.count.must_equal 5
45
+
46
+ validate_outer_layers(traces, 'rack')
47
+
48
+ traces[2]['Layer'].must_equal "grape"
49
+ traces[3]['Layer'].must_equal "grape"
50
+ traces[3].has_key?('Controller').must_equal true
51
+ traces[3].has_key?('Action').must_equal true
52
+ traces[4]['Label'].must_equal "exit"
53
+
54
+ # Validate the existence of the response header
55
+ r.headers.key?('X-Trace').must_equal true
56
+ r.headers['X-Trace'].must_equal traces[4]['X-Trace']
57
+ end
58
+
59
+ it "should trace a an error in a nested grape stack" do
60
+ @app = GrapeNested
61
+
62
+ r = get "/error"
63
+
64
+ r.status.must_equal 500
65
+ r.headers.key?('X-Trace').must_equal true
66
+
67
+ traces = get_all_traces
68
+ traces.count.must_equal 6
69
+
70
+ validate_outer_layers(traces, 'rack')
71
+
72
+ traces[2]['Layer'].must_equal "grape"
73
+ traces[2]['Label'].must_equal "entry"
74
+ traces[3]['Layer'].must_equal "grape"
27
75
  traces[3]['Label'].must_equal "exit"
76
+ traces[3].has_key?('Controller').must_equal true
77
+ traces[3].has_key?('Action').must_equal true
78
+ traces[4]['Label'].must_equal "error"
79
+ traces[4]['ErrorClass'].must_equal "GrapeError"
80
+ traces[4]['ErrorMsg'].must_equal "This is a error with 'error'!"
81
+ traces[4].has_key?('Backtrace').must_equal true
82
+ traces[5]['Layer'].must_equal "rack"
83
+ traces[5]['Label'].must_equal "exit"
28
84
 
29
85
  # Validate the existence of the response header
30
86
  r.headers.key?('X-Trace').must_equal true
31
- r.headers['X-Trace'].must_equal traces[3]['X-Trace']
87
+ r.headers['X-Trace'].must_equal traces[5]['X-Trace']
32
88
  end
33
89
 
90
+
34
91
  it "should trace a request with an exception" do
35
92
  @app = GrapeSimple
36
93
 
@@ -42,18 +99,18 @@ if RUBY_VERSION >= '1.9.3'
42
99
  end
43
100
 
44
101
  traces = get_all_traces
45
- traces.count.must_equal 5
102
+ traces.count.must_equal 6
46
103
 
47
104
  validate_outer_layers(traces, 'rack')
48
105
 
49
- traces[1]['Layer'].must_equal "grape"
50
106
  traces[2]['Layer'].must_equal "grape"
51
- traces[2].has_key?('Controller').must_equal true
52
- traces[2].has_key?('Action').must_equal true
53
- traces[3]['Label'].must_equal "error"
54
- traces[3]['ErrorClass'].must_equal "Exception"
55
- traces[3]['ErrorMsg'].must_equal "This should have http status code 500!"
56
- traces[4]['Label'].must_equal "exit"
107
+ traces[3]['Layer'].must_equal "grape"
108
+ traces[3].has_key?('Controller').must_equal true
109
+ traces[3].has_key?('Action').must_equal true
110
+ traces[4]['Label'].must_equal "error"
111
+ traces[4]['ErrorClass'].must_equal "Exception"
112
+ traces[4]['ErrorMsg'].must_equal "This should have http status code 500!"
113
+ traces[5]['Label'].must_equal "exit"
57
114
  end
58
115
 
59
116
  it "should trace a request with an error" do
@@ -62,7 +119,7 @@ if RUBY_VERSION >= '1.9.3'
62
119
  r = get "/error"
63
120
 
64
121
  traces = get_all_traces
65
- traces.count.must_equal 5
122
+ traces.count.must_equal 6
66
123
 
67
124
  r.status.must_equal 500
68
125
  r.headers.key?('X-Trace').must_equal true
@@ -70,16 +127,16 @@ if RUBY_VERSION >= '1.9.3'
70
127
  validate_outer_layers(traces, 'rack')
71
128
 
72
129
  traces[0]['Layer'].must_equal "rack"
73
- traces[1]['Layer'].must_equal "grape"
74
130
  traces[2]['Layer'].must_equal "grape"
75
- traces[2].has_key?('Controller').must_equal true
76
- traces[2].has_key?('Action').must_equal true
77
- traces[3]['Label'].must_equal "error"
78
- traces[3]['ErrorClass'].must_equal "GrapeError"
79
- traces[3]['ErrorMsg'].must_equal "This is a error with 'error'!"
80
- traces[4]['Layer'].must_equal "rack"
81
- traces[4]['Label'].must_equal "exit"
82
- traces[4]['Status'].must_equal "500"
131
+ traces[3]['Layer'].must_equal "grape"
132
+ traces[3].has_key?('Controller').must_equal true
133
+ traces[3].has_key?('Action').must_equal true
134
+ traces[4]['Label'].must_equal "error"
135
+ traces[4]['ErrorClass'].must_equal "GrapeError"
136
+ traces[4]['ErrorMsg'].must_equal "This is a error with 'error'!"
137
+ traces[5]['Layer'].must_equal "rack"
138
+ traces[5]['Label'].must_equal "exit"
139
+ traces[5]['Status'].must_equal 500
83
140
  end
84
141
  end
85
142
  end
@@ -13,17 +13,17 @@ if RUBY_VERSION >= '1.9.3'
13
13
  r = get "/render"
14
14
 
15
15
  traces = get_all_traces
16
- traces.count.must_equal 8
16
+ traces.count.must_equal 9
17
17
 
18
18
  validate_outer_layers(traces, 'rack')
19
19
 
20
- traces[1]['Layer'].must_equal "padrino"
21
- traces[6]['Controller'].must_equal "SimpleDemo"
22
- traces[7]['Label'].must_equal "exit"
20
+ traces[2]['Layer'].must_equal "padrino"
21
+ traces[7]['Controller'].must_equal "SimpleDemo"
22
+ traces[8]['Label'].must_equal "exit"
23
23
 
24
24
  # Validate the existence of the response header
25
25
  r.headers.key?('X-Trace').must_equal true
26
- r.headers['X-Trace'].must_equal traces[7]['X-Trace']
26
+ r.headers['X-Trace'].must_equal traces[8]['X-Trace']
27
27
  end
28
28
  end
29
29
  end
@@ -12,18 +12,18 @@ describe Sinatra do
12
12
  r = get "/render"
13
13
 
14
14
  traces = get_all_traces
15
- traces.count.must_equal 8
15
+ traces.count.must_equal 9
16
16
 
17
17
  validate_outer_layers(traces, 'rack')
18
18
 
19
- traces[1]['Layer'].must_equal "sinatra"
20
- traces[3]['Label'].must_equal "profile_entry"
21
- traces[6]['Controller'].must_equal "SinatraSimple"
22
- traces[7]['Label'].must_equal "exit"
19
+ traces[2]['Layer'].must_equal "sinatra"
20
+ traces[4]['Label'].must_equal "profile_entry"
21
+ traces[7]['Controller'].must_equal "SinatraSimple"
22
+ traces[8]['Label'].must_equal "exit"
23
23
 
24
24
  # Validate the existence of the response header
25
25
  r.headers.key?('X-Trace').must_equal true
26
- r.headers['X-Trace'].must_equal traces[7]['X-Trace']
26
+ r.headers['X-Trace'].must_equal traces[8]['X-Trace']
27
27
  end
28
28
  end
29
29
 
@@ -76,8 +76,8 @@ unless defined?(JRUBY_VERSION)
76
76
  traces[1]['Op'].must_equal "insert"
77
77
  traces[1]['Cf'].must_equal "Users"
78
78
  traces[1]['Key'].must_equal "\"5\""
79
- traces[1]['Consistency'].must_equal "1"
80
- traces[1]['Ttl'].must_equal "600"
79
+ traces[1]['Consistency'].must_equal 1
80
+ traces[1]['Ttl'].must_equal 600
81
81
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:cassandra][:collect_backtraces]
82
82
  validate_event_keys(traces[2], @exit_kvs)
83
83
  end
@@ -116,7 +116,7 @@ unless defined?(JRUBY_VERSION)
116
116
  traces[1]['Op'].must_equal "count_columns"
117
117
  traces[1]['Cf'].must_equal "Statuses"
118
118
  traces[1]['Key'].must_equal "\"12\""
119
- traces[1]['Count'].must_equal "50"
119
+ traces[1]['Count'].must_equal 50
120
120
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:cassandra][:collect_backtraces]
121
121
  validate_event_keys(traces[2], @exit_kvs)
122
122
  end
@@ -38,7 +38,7 @@ describe Oboe::Inst::FaradayConnection do
38
38
  traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
39
39
 
40
40
  traces[3]['Layer'].must_equal 'net-http'
41
- traces[3]['IsService'].must_equal '1'
41
+ traces[3]['IsService'].must_equal 1
42
42
  traces[3]['RemoteProtocol'].must_equal 'HTTP'
43
43
  traces[3]['RemoteHost'].must_equal 'www.gameface.in'
44
44
  traces[3]['ServiceArg'].must_equal '/games?q=1'
@@ -69,7 +69,7 @@ describe Oboe::Inst::FaradayConnection do
69
69
  traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
70
70
 
71
71
  traces[3]['Layer'].must_equal 'net-http'
72
- traces[3]['IsService'].must_equal '1'
72
+ traces[3]['IsService'].must_equal 1
73
73
  traces[3]['RemoteProtocol'].must_equal 'HTTP'
74
74
  traces[3]['RemoteHost'].must_equal 'www.curlmyip.com'
75
75
  traces[3]['ServiceArg'].must_equal '/?q=ruby_test_suite'
@@ -100,7 +100,7 @@ describe Oboe::Inst::FaradayConnection do
100
100
  traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
101
101
 
102
102
  traces[3]['Layer'].must_equal 'net-http'
103
- traces[3]['IsService'].must_equal '1'
103
+ traces[3]['IsService'].must_equal 1
104
104
  traces[3]['RemoteProtocol'].must_equal 'HTTP'
105
105
  traces[3]['RemoteHost'].must_equal 'www.curlmyip.com'
106
106
  traces[3]['ServiceArg'].must_equal '/?a=1'
@@ -133,7 +133,7 @@ describe Oboe::Inst::FaradayConnection do
133
133
  traces[1]['Layer'].must_equal 'faraday'
134
134
  traces[1].key?('Backtrace').must_equal Oboe::Config[:faraday][:collect_backtraces]
135
135
 
136
- traces[2]['IsService'].must_equal '1'
136
+ traces[2]['IsService'].must_equal 1
137
137
  traces[2]['RemoteProtocol'].must_equal 'HTTP'
138
138
  traces[2]['RemoteHost'].must_equal 'www.curlmyip.com'
139
139
  traces[2]['ServiceArg'].must_equal '/?q=1'
@@ -141,7 +141,7 @@ describe Oboe::Inst::FaradayConnection do
141
141
 
142
142
  traces[2]['Layer'].must_equal 'faraday'
143
143
  traces[2]['Label'].must_equal 'info'
144
- traces[2]['HTTPStatus'].must_equal '200'
144
+ traces[2]['HTTPStatus'].must_equal 200
145
145
 
146
146
  traces[3]['Layer'].must_equal 'faraday'
147
147
  traces[3]['Label'].must_equal 'exit'
@@ -37,7 +37,7 @@ describe Oboe::Inst do
37
37
  validate_outer_layers(traces, 'net-http_test')
38
38
 
39
39
  traces[1]['Layer'].must_equal 'net-http'
40
- traces[2]['IsService'].must_equal "1"
40
+ traces[2]['IsService'].must_equal 1
41
41
  traces[2]['RemoteProtocol'].must_equal "HTTP"
42
42
  traces[2]['RemoteHost'].must_equal "www.gameface.in"
43
43
  traces[2]['ServiceArg'].must_equal "/games?q=1"
@@ -59,7 +59,7 @@ describe Oboe::Inst do
59
59
  validate_outer_layers(traces, 'net-http_test')
60
60
 
61
61
  traces[1]['Layer'].must_equal 'net-http'
62
- traces[2]['IsService'].must_equal "1"
62
+ traces[2]['IsService'].must_equal 1
63
63
  traces[2]['RemoteProtocol'].must_equal "HTTP"
64
64
  traces[2]['RemoteHost'].must_equal "www.curlmyip.com"
65
65
  traces[2]['ServiceArg'].must_equal "/?q=1"
@@ -101,7 +101,7 @@ describe Oboe::API::Memcache do
101
101
  traces[1]['KVOp'].must_equal "get_multi"
102
102
 
103
103
  validate_event_keys(traces[2], @info_kvs)
104
- traces[2]['KVKeyCount'].must_equal "6"
104
+ traces[2]['KVKeyCount'].must_equal 6
105
105
  traces[2].has_key?('KVHitCount').must_equal true
106
106
  traces[2].has_key?('Backtrace').must_equal Oboe::Config[:memcache][:collect_backtraces]
107
107
 
@@ -89,7 +89,7 @@ if RUBY_VERSION < '2.0' and not defined?(JRUBY_VERSION)
89
89
 
90
90
  traces[1]['KVOp'].must_equal "get_multi"
91
91
 
92
- traces[2]['KVKeyCount'].must_equal "6"
92
+ traces[2]['KVKeyCount'].must_equal 6
93
93
  traces[2].has_key?('KVHitCount').must_equal true
94
94
  end
95
95
 
@@ -18,7 +18,7 @@ if RUBY_VERSION >= '1.9.3'
18
18
  'Flavor' => 'mongodb',
19
19
  'Database' => 'moped_test',
20
20
  'RemoteHost' => '127.0.0.1',
21
- 'RemotePort' => '27017' }
21
+ 'RemotePort' => 27017 }
22
22
 
23
23
  @exit_kvs = { 'Layer' => 'mongo', 'Label' => 'exit' }
24
24
  @collect_backtraces = Oboe::Config[:moped][:collect_backtraces]
@@ -24,7 +24,7 @@ class RackTestApp < Minitest::Test
24
24
  get "/lobster"
25
25
 
26
26
  traces = get_all_traces
27
- traces.count.must_equal 2
27
+ traces.count.must_equal 3
28
28
 
29
29
  validate_outer_layers(traces, 'rack')
30
30
 
@@ -33,10 +33,9 @@ class RackTestApp < Minitest::Test
33
33
  validate_event_keys(traces[0], kvs)
34
34
 
35
35
  kvs.clear
36
- kvs["Label"] = "exit"
37
- kvs["Status"] = "200"
36
+ kvs["Label"] = "info"
38
37
  kvs["HTTP-Host"] = "example.org"
39
- kvs["Port"] = "80"
38
+ kvs["Port"] = 80
40
39
  kvs["Proto"] = "http"
41
40
  kvs["URL"] = "/lobster"
42
41
  kvs["Method"] = "GET"
@@ -48,6 +47,9 @@ class RackTestApp < Minitest::Test
48
47
  assert traces[1].has_key?('ProcessID')
49
48
  assert traces[1].has_key?('ThreadID')
50
49
 
50
+ assert traces[2]["Label"] == 'exit'
51
+ assert traces[2]["Status"] == 200
52
+
51
53
  assert last_response.ok?
52
54
 
53
55
  assert last_response['X-Trace']
@@ -90,9 +90,9 @@ describe Oboe::Inst::Redis, :hashes do
90
90
  traces.count.must_equal 6
91
91
  traces[2]['KVOp'].must_equal "hget"
92
92
  traces[2]['KVKey'].must_equal "whale"
93
- traces[2]['KVHit'].must_equal "1"
93
+ traces[2]['KVHit'].must_equal 1
94
94
  traces[2]['field'].must_equal "color"
95
- traces[4]['KVHit'].must_equal "0"
95
+ traces[4]['KVHit'].must_equal 0
96
96
  end
97
97
 
98
98
  it "should trace hgetall" do
@@ -124,7 +124,7 @@ describe Oboe::Inst::Redis, :hashes do
124
124
  traces[2]['KVOp'].must_equal "hincrby"
125
125
  traces[2]['KVKey'].must_equal "whale"
126
126
  traces[2]['field'].must_equal "age"
127
- traces[2]['increment'].must_equal "1"
127
+ traces[2]['increment'].must_equal 1
128
128
  end
129
129
 
130
130
  it "should trace hincrbyfloat" do
@@ -141,7 +141,7 @@ describe Oboe::Inst::Redis, :hashes do
141
141
  traces[2]['KVOp'].must_equal "hincrbyfloat"
142
142
  traces[2]['KVKey'].must_equal "whale"
143
143
  traces[2]['field'].must_equal "age"
144
- traces[2]['increment'].must_equal "1.3"
144
+ traces[2]['increment'].must_equal 1.3
145
145
  end
146
146
 
147
147
  it "should trace hkeys" do
@@ -189,8 +189,8 @@ describe Oboe::Inst::Redis, :hashes do
189
189
  traces.count.must_equal 4
190
190
  traces[2]['KVOp'].must_equal "hmget"
191
191
  traces[2]['KVKey'].must_equal "whale"
192
- traces[2]['KVKeyCount'].must_equal "4"
193
- traces[2]['KVHitCount'].must_equal "2"
192
+ traces[2]['KVKeyCount'].must_equal 4
193
+ traces[2]['KVHitCount'].must_equal 2
194
194
  end
195
195
 
196
196
  it "should trace hmset" do
@@ -130,7 +130,7 @@ describe Oboe::Inst::Redis, :keys do
130
130
  traces.count.must_equal 4
131
131
  traces[2]['KVOp'].must_equal "move"
132
132
  traces[2]['KVKey'].must_equal "piano"
133
- traces[2]['db'].must_equal "1"
133
+ traces[2]['db'].must_equal 1
134
134
  end
135
135
 
136
136
  it "should trace persist" do
@@ -163,7 +163,7 @@ describe Oboe::Inst::Redis, :keys do
163
163
  traces.count.must_equal 4
164
164
  traces[2]['KVOp'].must_equal "pexpire"
165
165
  traces[2]['KVKey'].must_equal "sand"
166
- traces[2]['milliseconds'].must_equal "8000"
166
+ traces[2]['milliseconds'].must_equal 8000
167
167
  end
168
168
 
169
169
  it "should trace pexpireat" do
@@ -181,7 +181,7 @@ describe Oboe::Inst::Redis, :keys do
181
181
  traces.count.must_equal 4
182
182
  traces[2]['KVOp'].must_equal "pexpireat"
183
183
  traces[2]['KVKey'].must_equal "sand"
184
- traces[2]['milliseconds'].must_equal "8000"
184
+ traces[2]['milliseconds'].must_equal 8000
185
185
  end
186
186
 
187
187
  it "should trace pttl" do
@@ -252,7 +252,7 @@ describe Oboe::Inst::Redis, :keys do
252
252
  traces.count.must_equal 4
253
253
  traces[2]['KVOp'].must_equal "restore"
254
254
  traces[2]['KVKey'].must_equal "blue"
255
- traces[2]['ttl'].must_equal "0"
255
+ traces[2]['ttl'].must_equal 0
256
256
  end
257
257
 
258
258
  it "should trace sort" do
@@ -85,7 +85,7 @@ describe Oboe::Inst::Redis, :lists do
85
85
  traces = get_all_traces
86
86
  traces.count.must_equal 4
87
87
  traces[2]['KVOp'].must_equal "lindex"
88
- traces[2]['index'].must_equal "1"
88
+ traces[2]['index'].must_equal 1
89
89
  end
90
90
 
91
91
  it "should trace linsert" do
@@ -182,8 +182,8 @@ describe Oboe::Inst::Redis, :lists do
182
182
  traces.count.must_equal 4
183
183
  traces[2]['KVOp'].must_equal "lrange"
184
184
  traces[2]['KVKey'].must_equal "protein types"
185
- traces[2]['start'].must_equal "2"
186
- traces[2]['stop'].must_equal "4"
185
+ traces[2]['start'].must_equal 2
186
+ traces[2]['stop'].must_equal 4
187
187
  end
188
188
 
189
189
  it "should trace lrem" do
@@ -46,7 +46,7 @@ describe Oboe::Inst::Redis, :misc do
46
46
  traces = get_all_traces
47
47
  traces.count.must_equal 4
48
48
  traces[2]['KVOp'].must_equal "select"
49
- traces[2]['db'].must_equal "2"
49
+ traces[2]['db'].must_equal 2
50
50
  end
51
51
 
52
52
  it "should trace pipelined operations" do
@@ -66,7 +66,7 @@ describe Oboe::Inst::Redis, :misc do
66
66
 
67
67
  traces = get_all_traces
68
68
  traces.count.must_equal 4
69
- traces[2]['KVOpCount'].must_equal "6"
69
+ traces[2]['KVOpCount'].must_equal 6
70
70
  traces[2]['KVOps'].must_equal "zadd, zadd, zadd, lpush, lpush, lpush"
71
71
  end
72
72
 
@@ -87,7 +87,7 @@ describe Oboe::Inst::Redis, :misc do
87
87
 
88
88
  traces = get_all_traces
89
89
  traces.count.must_equal 4
90
- traces[2]['KVOpCount'].must_equal "8"
90
+ traces[2]['KVOpCount'].must_equal 8
91
91
  traces[2]['KVOps'].must_equal "multi, zadd, zadd, zadd, lpush, lpush, lpush, exec"
92
92
  end
93
93
 
@@ -206,8 +206,8 @@ describe Oboe::Inst::Redis, :sortedsets do
206
206
  traces.count.must_equal 4
207
207
  traces[2]['KVOp'].must_equal "zremrangebyrank"
208
208
  traces[2]['KVKey'].must_equal "sauce"
209
- traces[2]['start'].must_equal "-5"
210
- traces[2]['stop'].must_equal "-1"
209
+ traces[2]['start'].must_equal -5
210
+ traces[2]['stop'].must_equal -1
211
211
  end
212
212
 
213
213
  it "should trace zremrangebyscore" do
@@ -246,8 +246,8 @@ describe Oboe::Inst::Redis, :sortedsets do
246
246
  traces.count.must_equal 4
247
247
  traces[2]['KVOp'].must_equal "zrevrange"
248
248
  traces[2]['KVKey'].must_equal "sauce"
249
- traces[2]['start'].must_equal "0"
250
- traces[2]['stop'].must_equal "-1"
249
+ traces[2]['start'].must_equal 0
250
+ traces[2]['stop'].must_equal -1
251
251
  end
252
252
 
253
253
  it "should trace zrevrangebyscore" do
@@ -46,8 +46,8 @@ describe Oboe::Inst::Redis, :strings do
46
46
  traces = get_all_traces
47
47
  traces.count.must_equal 4
48
48
  traces[2]['KVOp'].must_equal "bitcount"
49
- traces[2]['start'].must_equal "0"
50
- traces[2]['stop'].must_equal "-1"
49
+ traces[2]['start'].must_equal 0
50
+ traces[2]['stop'].must_equal -1
51
51
  end
52
52
 
53
53
  it "should trace bitop (>=2.6)" do
@@ -89,7 +89,7 @@ describe Oboe::Inst::Redis, :strings do
89
89
  traces.count.must_equal 4
90
90
  traces[2]['KVOp'].must_equal "decrby"
91
91
  traces[2]['KVKey'].must_equal "decr"
92
- traces[2]['decrement'].must_equal "1"
92
+ traces[2]['decrement'].must_equal 1
93
93
  end
94
94
 
95
95
  it "should trace get" do
@@ -120,7 +120,7 @@ describe Oboe::Inst::Redis, :strings do
120
120
  traces.count.must_equal 4
121
121
  traces[2]['KVOp'].must_equal "getbit"
122
122
  traces[2]['KVKey'].must_equal "diwore"
123
- traces[2]['offset'].must_equal "3"
123
+ traces[2]['offset'].must_equal 3
124
124
  end
125
125
 
126
126
  it "should trace getrange" do
@@ -134,8 +134,8 @@ describe Oboe::Inst::Redis, :strings do
134
134
  traces.count.must_equal 4
135
135
  traces[2]['KVOp'].must_equal "getrange"
136
136
  traces[2]['KVKey'].must_equal "yourkey"
137
- traces[2]['start'].must_equal "0"
138
- traces[2]['end'].must_equal "3"
137
+ traces[2]['start'].must_equal 0
138
+ traces[2]['end'].must_equal 3
139
139
  end
140
140
 
141
141
  it "should trace getset" do
@@ -176,7 +176,7 @@ describe Oboe::Inst::Redis, :strings do
176
176
  traces.count.must_equal 4
177
177
  traces[2]['KVOp'].must_equal "incrby"
178
178
  traces[2]['KVKey'].must_equal "incr"
179
- traces[2]['increment'].must_equal "1"
179
+ traces[2]['increment'].must_equal 1
180
180
  end
181
181
 
182
182
  it "should trace incrbyfloat" do
@@ -192,7 +192,7 @@ describe Oboe::Inst::Redis, :strings do
192
192
  traces.count.must_equal 4
193
193
  traces[2]['KVOp'].must_equal "incrbyfloat"
194
194
  traces[2]['KVKey'].must_equal "incrfloat"
195
- traces[2]['increment'].must_equal "1.01"
195
+ traces[2]['increment'].must_equal 1.01
196
196
  end
197
197
 
198
198
  it "should trace mget" do
@@ -208,11 +208,11 @@ describe Oboe::Inst::Redis, :strings do
208
208
  traces = get_all_traces
209
209
  traces.count.must_equal 6
210
210
  traces[2]['KVOp'].must_equal "mget"
211
- traces[2]['KVKeyCount'].must_equal "3"
212
- traces[2]['KVHitCount'].must_equal "2"
211
+ traces[2]['KVKeyCount'].must_equal 3
212
+ traces[2]['KVHitCount'].must_equal 2
213
213
  traces[4]['KVOp'].must_equal "mget"
214
- traces[4]['KVKeyCount'].must_equal "1"
215
- traces[4]['KVHitCount'].must_equal "1"
214
+ traces[4]['KVKeyCount'].must_equal 1
215
+ traces[4]['KVHitCount'].must_equal 1
216
216
  end
217
217
 
218
218
  it "should trace mset" do
@@ -224,9 +224,9 @@ describe Oboe::Inst::Redis, :strings do
224
224
  traces = get_all_traces
225
225
  traces.count.must_equal 6
226
226
  traces[2]['KVOp'].must_equal "mset"
227
- traces[2]['KVKeyCount'].must_equal "3"
227
+ traces[2]['KVKeyCount'].must_equal 3
228
228
  traces[4]['KVOp'].must_equal "mset"
229
- traces[4]['KVKeyCount'].must_equal "1"
229
+ traces[4]['KVKeyCount'].must_equal 1
230
230
  end
231
231
 
232
232
  it "should trace msetnx" do
@@ -249,7 +249,7 @@ describe Oboe::Inst::Redis, :strings do
249
249
  traces.count.must_equal 4
250
250
  traces[2]['KVOp'].must_equal "psetex"
251
251
  traces[2]['KVKey'].must_equal "one"
252
- traces[2]['ttl'].must_equal "60"
252
+ traces[2]['ttl'].must_equal 60
253
253
  end
254
254
 
255
255
  it "should trace basic set" do
@@ -274,7 +274,7 @@ describe Oboe::Inst::Redis, :strings do
274
274
  traces.count.must_equal 4
275
275
  traces[2]['KVOp'].must_equal "setbit"
276
276
  traces[2]['KVKey'].must_equal "yourkey"
277
- traces[2]['offset'].must_equal "3"
277
+ traces[2]['offset'].must_equal 3
278
278
  end
279
279
 
280
280
  it "should trace setex" do
@@ -286,7 +286,7 @@ describe Oboe::Inst::Redis, :strings do
286
286
  traces.count.must_equal 4
287
287
  traces[2]['KVOp'].must_equal "setex"
288
288
  traces[2]['KVKey'].must_equal "one"
289
- traces[2]['ttl'].must_equal "60"
289
+ traces[2]['ttl'].must_equal 60
290
290
  end
291
291
 
292
292
  it "should trace setnx" do
@@ -313,7 +313,7 @@ describe Oboe::Inst::Redis, :strings do
313
313
  traces.count.must_equal 4
314
314
  traces[2]['KVOp'].must_equal "setrange"
315
315
  traces[2]['KVKey'].must_equal "yourkey"
316
- traces[2]['offset'].must_equal "2"
316
+ traces[2]['offset'].must_equal 2
317
317
  end
318
318
 
319
319
  it "should trace strlen" do
@@ -26,7 +26,7 @@ unless defined?(JRUBY_VERSION)
26
26
  'Label' => 'entry',
27
27
  'Database' => 'travis_ci_test',
28
28
  'RemoteHost' => '127.0.0.1',
29
- 'RemotePort' => '3306' }
29
+ 'RemotePort' => 3306 }
30
30
 
31
31
  @exit_kvs = { 'Layer' => 'sequel', 'Label' => 'exit' }
32
32
  @collect_backtraces = Oboe::Config[:sequel][:collect_backtraces]
@@ -112,7 +112,7 @@ unless defined?(JRUBY_VERSION)
112
112
  items.count
113
113
 
114
114
  Oboe::API.start_trace('sequel_test', '', {}) do
115
- items.insert(:name => 'abc', :price => 2.514461383352462)
115
+ items.insert(:name => 'abc', :price => 2.514)
116
116
  items.count
117
117
  end
118
118
 
@@ -122,11 +122,14 @@ unless defined?(JRUBY_VERSION)
122
122
  validate_outer_layers(traces, 'sequel_test')
123
123
 
124
124
  validate_event_keys(traces[1], @entry_kvs)
125
- if RUBY_VERSION < "1.9"
126
- traces[1]['Query'].must_equal "INSERT INTO `items` (`price`, `name`) VALUES (2.51446138335246, 'abc')"
127
- else
128
- traces[1]['Query'].must_equal "INSERT INTO `items` (`name`, `price`) VALUES ('abc', 2.514461383352462)"
129
- end
125
+
126
+ # SQL column/value order can vary between Ruby and gem versions
127
+ # Use must_include to test against one or the other
128
+ [
129
+ "INSERT INTO `items` (`price`, `name`) VALUES (2.514, 'abc')",
130
+ "INSERT INTO `items` (`name`, `price`) VALUES ('abc', 2.514)"
131
+ ].must_include traces[1]['Query']
132
+
130
133
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
131
134
  traces[2]['Layer'].must_equal "sequel"
132
135
  traces[2]['Label'].must_equal "exit"
@@ -149,11 +152,14 @@ unless defined?(JRUBY_VERSION)
149
152
  validate_outer_layers(traces, 'sequel_test')
150
153
 
151
154
  validate_event_keys(traces[1], @entry_kvs)
152
- if RUBY_VERSION < "1.9"
153
- traces[1]['Query'].must_equal "INSERT INTO `items` (`price`, `name`) VALUES (?, ?)"
154
- else
155
- traces[1]['Query'].must_equal "INSERT INTO `items` (`name`, `price`) VALUES (?, ?)"
156
- end
155
+
156
+ # SQL column/value order can vary between Ruby and gem versions
157
+ # Use must_include to test against one or the other
158
+ [
159
+ "INSERT INTO `items` (`price`, `name`) VALUES (?, ?)",
160
+ "INSERT INTO `items` (`name`, `price`) VALUES (?, ?)"
161
+ ].must_include traces[1]['Query']
162
+
157
163
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
158
164
  validate_event_keys(traces[2], @exit_kvs)
159
165
  end
@@ -26,7 +26,7 @@ unless defined?(JRUBY_VERSION)
26
26
  'Label' => 'entry',
27
27
  'Database' => 'travis_ci_test',
28
28
  'RemoteHost' => '127.0.0.1',
29
- 'RemotePort' => '3306' }
29
+ 'RemotePort' => 3306 }
30
30
 
31
31
  @exit_kvs = { 'Layer' => 'sequel', 'Label' => 'exit' }
32
32
  @collect_backtraces = Oboe::Config[:sequel][:collect_backtraces]
@@ -112,7 +112,7 @@ unless defined?(JRUBY_VERSION)
112
112
  items.count
113
113
 
114
114
  Oboe::API.start_trace('sequel_test', '', {}) do
115
- items.insert(:name => 'abc', :price => 2.514461383352462)
115
+ items.insert(:name => 'abc', :price => 2.514)
116
116
  items.count
117
117
  end
118
118
 
@@ -122,11 +122,14 @@ unless defined?(JRUBY_VERSION)
122
122
  validate_outer_layers(traces, 'sequel_test')
123
123
 
124
124
  validate_event_keys(traces[1], @entry_kvs)
125
- if RUBY_VERSION < "1.9"
126
- traces[1]['Query'].must_equal "INSERT INTO `items` (`price`, `name`) VALUES (2.51446138335246, 'abc')"
127
- else
128
- traces[1]['Query'].must_equal "INSERT INTO `items` (`name`, `price`) VALUES ('abc', 2.514461383352462)"
129
- end
125
+
126
+ # SQL column/value order can vary between Ruby and gem versions
127
+ # Use must_include to test against one or the other
128
+ [
129
+ "INSERT INTO `items` (`price`, `name`) VALUES (2.514, 'abc')",
130
+ "INSERT INTO `items` (`name`, `price`) VALUES ('abc', 2.514)"
131
+ ].must_include traces[1]['Query']
132
+
130
133
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
131
134
  traces[2]['Layer'].must_equal "sequel"
132
135
  traces[2]['Label'].must_equal "exit"
@@ -149,11 +152,14 @@ unless defined?(JRUBY_VERSION)
149
152
  validate_outer_layers(traces, 'sequel_test')
150
153
 
151
154
  validate_event_keys(traces[1], @entry_kvs)
152
- if RUBY_VERSION < "1.9"
153
- traces[1]['Query'].must_equal "INSERT INTO `items` (`price`, `name`) VALUES (?, ?)"
154
- else
155
- traces[1]['Query'].must_equal "INSERT INTO `items` (`name`, `price`) VALUES (?, ?)"
156
- end
155
+
156
+ # SQL column/value order can vary between Ruby and gem versions
157
+ # Use must_include to test against one or the other
158
+ [
159
+ "INSERT INTO `items` (`price`, `name`) VALUES (?, ?)",
160
+ "INSERT INTO `items` (`name`, `price`) VALUES (?, ?)"
161
+ ].must_include traces[1]['Query']
162
+
157
163
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
158
164
  validate_event_keys(traces[2], @exit_kvs)
159
165
  end
@@ -26,7 +26,7 @@ unless defined?(JRUBY_VERSION)
26
26
  'Label' => 'entry',
27
27
  'Database' => 'travis_ci_test',
28
28
  'RemoteHost' => '127.0.0.1',
29
- 'RemotePort' => '5432' }
29
+ 'RemotePort' => 5432 }
30
30
 
31
31
  @exit_kvs = { 'Layer' => 'sequel', 'Label' => 'exit' }
32
32
  @collect_backtraces = Oboe::Config[:sequel][:collect_backtraces]
@@ -114,7 +114,7 @@ unless defined?(JRUBY_VERSION)
114
114
  PG_DB.primary_key(:items)
115
115
 
116
116
  Oboe::API.start_trace('sequel_test', '', {}) do
117
- items.insert(:name => 'abc', :price => 2.514461383352462)
117
+ items.insert(:name => 'abc', :price => 2.514)
118
118
  items.count
119
119
  end
120
120
 
@@ -124,11 +124,14 @@ unless defined?(JRUBY_VERSION)
124
124
  validate_outer_layers(traces, 'sequel_test')
125
125
 
126
126
  validate_event_keys(traces[1], @entry_kvs)
127
- if RUBY_VERSION < "1.9"
128
- traces[1]['Query'].must_equal "INSERT INTO \"items\" (\"price\", \"name\") VALUES (2.51446138335246, 'abc') RETURNING \"id\""
129
- else
130
- traces[1]['Query'].must_equal "INSERT INTO \"items\" (\"name\", \"price\") VALUES ('abc', 2.514461383352462) RETURNING \"id\""
131
- end
127
+
128
+ # SQL column/value order can vary between Ruby and gem versions
129
+ # Use must_include to test against one or the other
130
+ [
131
+ "INSERT INTO \"items\" (\"price\", \"name\") VALUES (2.514, 'abc') RETURNING \"id\"",
132
+ "INSERT INTO \"items\" (\"name\", \"price\") VALUES ('abc', 2.514) RETURNING \"id\""
133
+ ].must_include traces[1]['Query']
134
+
132
135
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
133
136
  traces[2]['Layer'].must_equal "sequel"
134
137
  traces[2]['Label'].must_equal "exit"
@@ -153,11 +156,14 @@ unless defined?(JRUBY_VERSION)
153
156
  validate_outer_layers(traces, 'sequel_test')
154
157
 
155
158
  validate_event_keys(traces[1], @entry_kvs)
156
- if RUBY_VERSION < "1.9"
157
- traces[1]['Query'].must_equal "INSERT INTO \"items\" (\"price\", \"name\") VALUES (?, ?) RETURNING \"id\""
158
- else
159
- traces[1]['Query'].must_equal "INSERT INTO \"items\" (\"name\", \"price\") VALUES (?, ?) RETURNING \"id\""
160
- end
159
+
160
+ # SQL column/value order can vary between Ruby and gem versions
161
+ # Use must_include to test against one or the other
162
+ [
163
+ "INSERT INTO \"items\" (\"price\", \"name\") VALUES (?, ?) RETURNING \"id\"",
164
+ "INSERT INTO \"items\" (\"name\", \"price\") VALUES (?, ?) RETURNING \"id\""
165
+ ].must_include traces[1]['Query']
166
+
161
167
  traces[1].has_key?('Backtrace').must_equal Oboe::Config[:sequel][:collect_backtraces]
162
168
  validate_event_keys(traces[2], @exit_kvs)
163
169
  end
@@ -36,12 +36,12 @@ describe Oboe::Inst::TyphoeusRequestOps do
36
36
 
37
37
  traces[2]['Layer'].must_equal 'typhoeus'
38
38
  traces[2]['Label'].must_equal 'info'
39
- traces[2]['IsService'].must_equal '1'
39
+ traces[2]['IsService'].must_equal 1
40
40
  traces[2]['RemoteProtocol'].downcase.must_equal 'http'
41
41
  traces[2]['RemoteHost'].must_equal 'www.appneta.com'
42
42
  traces[2]['ServiceArg'].must_equal '/products/traceview/'
43
43
  traces[2]['HTTPMethod'].must_equal 'get'
44
- traces[2]['HTTPStatus'].must_equal '200'
44
+ traces[2]['HTTPStatus'].must_equal 200
45
45
 
46
46
  traces[3]['Layer'].must_equal 'typhoeus'
47
47
  traces[3]['Label'].must_equal 'exit'
@@ -63,13 +63,13 @@ describe Oboe::Inst::TyphoeusRequestOps do
63
63
 
64
64
  traces[2]['Layer'].must_equal 'typhoeus'
65
65
  traces[2]['Label'].must_equal 'info'
66
- traces[2]['IsService'].must_equal '1'
66
+ traces[2]['IsService'].must_equal 1
67
67
  traces[2]['RemoteProtocol'].downcase.must_equal 'https'
68
68
  traces[2]['RemoteHost'].must_equal 'internal.tv.appneta.com'
69
- traces[2]['RemotePort'].must_equal '443'
69
+ traces[2]['RemotePort'].must_equal 443
70
70
  traces[2]['ServiceArg'].must_equal '/api-v2/log_message'
71
71
  traces[2]['HTTPMethod'].must_equal 'post'
72
- traces[2]['HTTPStatus'].must_equal '302'
72
+ traces[2]['HTTPStatus'].must_equal 302
73
73
 
74
74
  traces[3]['Layer'].must_equal 'typhoeus'
75
75
  traces[3]['Label'].must_equal 'exit'
@@ -91,13 +91,13 @@ describe Oboe::Inst::TyphoeusRequestOps do
91
91
 
92
92
  traces[2]['Layer'].must_equal 'typhoeus'
93
93
  traces[2]['Label'].must_equal 'info'
94
- traces[2]['IsService'].must_equal '1'
94
+ traces[2]['IsService'].must_equal 1
95
95
  traces[2]['RemoteProtocol'].downcase.must_equal 'https'
96
96
  traces[2]['RemoteHost'].must_equal 'internal.tv.appneta.com'
97
- traces[2]['RemotePort'].must_equal '443'
97
+ traces[2]['RemotePort'].must_equal 443
98
98
  traces[2]['ServiceArg'].must_equal '/api-v2/log_message'
99
99
  traces[2]['HTTPMethod'].must_equal 'put'
100
- traces[2]['HTTPStatus'].must_equal '405'
100
+ traces[2]['HTTPStatus'].must_equal 405
101
101
 
102
102
  traces[3]['Layer'].must_equal 'typhoeus'
103
103
  traces[3]['Label'].must_equal 'exit'
@@ -118,13 +118,13 @@ describe Oboe::Inst::TyphoeusRequestOps do
118
118
 
119
119
  traces[2]['Layer'].must_equal 'typhoeus'
120
120
  traces[2]['Label'].must_equal 'info'
121
- traces[2]['IsService'].must_equal '1'
121
+ traces[2]['IsService'].must_equal 1
122
122
  traces[2]['RemoteProtocol'].downcase.must_equal 'https'
123
123
  traces[2]['RemoteHost'].must_equal 'internal.tv.appneta.com'
124
- traces[2]['RemotePort'].must_equal '443'
124
+ traces[2]['RemotePort'].must_equal 443
125
125
  traces[2]['ServiceArg'].must_equal '/api-v2/log_message'
126
126
  traces[2]['HTTPMethod'].must_equal 'delete'
127
- traces[2]['HTTPStatus'].must_equal '405'
127
+ traces[2]['HTTPStatus'].must_equal 405
128
128
 
129
129
  traces[3]['Layer'].must_equal 'typhoeus'
130
130
  traces[3]['Label'].must_equal 'exit'
@@ -145,12 +145,12 @@ describe Oboe::Inst::TyphoeusRequestOps do
145
145
 
146
146
  traces[2]['Layer'].must_equal 'typhoeus'
147
147
  traces[2]['Label'].must_equal 'info'
148
- traces[2]['IsService'].must_equal '1'
148
+ traces[2]['IsService'].must_equal 1
149
149
  traces[2]['RemoteProtocol'].downcase.must_equal 'http'
150
150
  traces[2]['RemoteHost'].must_equal 'www.appneta.com'
151
151
  traces[2]['ServiceArg'].must_equal '/'
152
152
  traces[2]['HTTPMethod'].must_equal 'head'
153
- traces[2]['HTTPStatus'].must_equal '200'
153
+ traces[2]['HTTPStatus'].must_equal 200
154
154
 
155
155
  traces[3]['Layer'].must_equal 'typhoeus'
156
156
  traces[3]['Label'].must_equal 'exit'
@@ -171,12 +171,12 @@ describe Oboe::Inst::TyphoeusRequestOps do
171
171
 
172
172
  traces[2]['Layer'].must_equal 'typhoeus'
173
173
  traces[2]['Label'].must_equal 'info'
174
- traces[2]['IsService'].must_equal '1'
174
+ traces[2]['IsService'].must_equal 1
175
175
  traces[2]['RemoteProtocol'].downcase.must_equal 'http'
176
176
  traces[2]['RemoteHost'].must_equal 'www.gameface.in'
177
177
  traces[2]['ServiceArg'].must_equal '/gamers'
178
178
  traces[2]['HTTPMethod'].must_equal 'get'
179
- traces[2]['HTTPStatus'].must_equal '200'
179
+ traces[2]['HTTPStatus'].must_equal 200
180
180
 
181
181
  traces[3]['Layer'].must_equal 'typhoeus'
182
182
  traces[3]['Label'].must_equal 'exit'
@@ -204,34 +204,37 @@ describe Oboe::Inst::TyphoeusRequestOps do
204
204
  end
205
205
 
206
206
  traces = get_all_traces
207
- traces.count.must_equal 7
207
+ traces.count.must_equal 8
208
208
 
209
209
  validate_outer_layers(traces, 'outer')
210
210
 
211
+ #require 'byebug'
212
+ #debugger
213
+
211
214
  traces[2]['Layer'].must_equal 'rack'
212
215
  traces[2]['Label'].must_equal 'entry'
213
- traces[3]['Layer'].must_equal 'rack'
214
- traces[3]['Label'].must_equal 'exit'
216
+ traces[4]['Layer'].must_equal 'rack'
217
+ traces[4]['Label'].must_equal 'exit'
215
218
 
216
219
  # Verify typhoeus info edges to inner exit
217
- traces[5]['Edge'].must_equal traces[4]['X-Trace'][42...58]
220
+ traces[6]['Edge'].must_equal traces[5]['X-Trace'][42...58]
218
221
 
219
222
  # Verify typhoeus events
220
223
  traces[1]['Layer'].must_equal 'typhoeus'
221
224
  traces[1].key?('Backtrace').must_equal Oboe::Config[:typhoeus][:collect_backtraces]
222
225
 
223
- traces[4]['Layer'].must_equal 'typhoeus'
224
- traces[4]['Label'].must_equal 'info'
225
- traces[4]['IsService'].must_equal '1'
226
- traces[4]['RemoteProtocol'].downcase.must_equal 'http'
227
- traces[4]['RemoteHost'].must_equal '127.0.0.1'
228
- traces[4]['RemotePort'].must_equal '8000'
229
- traces[4]['ServiceArg'].must_equal '/'
230
- traces[4]['HTTPMethod'].must_equal 'get'
231
- traces[4]['HTTPStatus'].must_equal '200'
232
-
233
226
  traces[5]['Layer'].must_equal 'typhoeus'
234
- traces[5]['Label'].must_equal 'exit'
227
+ traces[5]['Label'].must_equal 'info'
228
+ traces[5]['IsService'].must_equal 1
229
+ traces[5]['RemoteProtocol'].downcase.must_equal 'http'
230
+ traces[5]['RemoteHost'].must_equal '127.0.0.1'
231
+ traces[5]['RemotePort'].must_equal 8000
232
+ traces[5]['ServiceArg'].must_equal '/'
233
+ traces[5]['HTTPMethod'].must_equal 'get'
234
+ traces[5]['HTTPStatus'].must_equal 200
235
+
236
+ traces[6]['Layer'].must_equal 'typhoeus'
237
+ traces[6]['Label'].must_equal 'exit'
235
238
  end
236
239
 
237
240
  it 'should trace a typhoeus GET request with DNS error' do
@@ -252,12 +255,12 @@ describe Oboe::Inst::TyphoeusRequestOps do
252
255
 
253
256
  traces[3]['Layer'].must_equal 'typhoeus'
254
257
  traces[3]['Label'].must_equal 'info'
255
- traces[3]['IsService'].must_equal '1'
258
+ traces[3]['IsService'].must_equal 1
256
259
  traces[3]['RemoteProtocol'].downcase.must_equal 'http'
257
260
  traces[3]['RemoteHost'].must_equal 'thisdomaindoesntexisthopefully.asdf'
258
261
  traces[3]['ServiceArg'].must_equal '/products/traceview/'
259
262
  traces[3]['HTTPMethod'].must_equal 'get'
260
- traces[3]['HTTPStatus'].must_equal '0'
263
+ traces[3]['HTTPStatus'].must_equal 0
261
264
 
262
265
  traces[3]['Layer'].must_equal 'typhoeus'
263
266
  traces[3]['Label'].must_equal 'info'
@@ -32,15 +32,74 @@ unless defined?(JRUBY_VERSION)
32
32
  get "/lobster"
33
33
 
34
34
  traces = get_all_traces
35
- traces.count.must_equal 2
35
+ traces.count.must_equal 3
36
36
 
37
37
  validate_outer_layers(traces, 'rack')
38
38
 
39
39
  kvs = {}
40
- kvs["SampleRate"] = "1000000"
41
- kvs["SampleSource"] = OBOE_SAMPLE_RATE_SOURCE_FILE.to_s
40
+ kvs["SampleRate"] = 1000000
41
+ kvs["SampleSource"] = OBOE_SAMPLE_RATE_SOURCE_FILE
42
42
  validate_event_keys(traces[0], kvs)
43
+ end
44
+
45
+ # Test logging of all Ruby datatypes against the SWIG wrapper
46
+ # of addInfo which only has four overloads.
47
+ def test_swig_datatypes_conversion
48
+ event = Oboe::Context.createEvent
49
+ report_kvs = {}
50
+
51
+ # Array
52
+ report_kvs[:TestData] = [0, 1, 2, 5, 7.0]
53
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
54
+
55
+ # Class
56
+ report_kvs[:TestData] = Oboe::Reporter
57
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
58
+
59
+ # FalseClass
60
+ report_kvs[:TestData] = false
61
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
62
+
63
+ # Fixnum
64
+ report_kvs[:TestData] = 1_873_293_293
65
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
66
+
67
+ # Float
68
+ report_kvs[:TestData] = 1.0001
69
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
70
+
71
+ # Hash
72
+ report_kvs[:TestData] = Hash.new
73
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
43
74
 
75
+ # Integer
76
+ report_kvs[:TestData] = 1
77
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
78
+
79
+ # Module
80
+ report_kvs[:TestData] = Oboe
81
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
82
+
83
+ # NilClass
84
+ report_kvs[:TestData] = nil
85
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
86
+
87
+ # Set
88
+ report_kvs[:TestData] = Set.new(1..10)
89
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
90
+
91
+ # String
92
+ report_kvs[:TestData] = 'test value'
93
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
94
+
95
+ # Symbol
96
+ report_kvs[:TestData] = :TestValue
97
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
98
+
99
+ # TrueClass
100
+ report_kvs[:TestData] = true
101
+ result = Oboe::API.log_event('test_layer', 'entry', event, report_kvs)
44
102
  end
45
103
  end
104
+
46
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oboe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.11.1
4
+ version: 2.7.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Giacomo Lombardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-19 00:00:00.000000000 Z
12
+ date: 2015-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -129,6 +129,7 @@ files:
129
129
  - lib/rails/generators/oboe/templates/oboe_initializer.rb
130
130
  - oboe.gemspec
131
131
  - release.sh
132
+ - test/frameworks/apps/grape_nested.rb
132
133
  - test/frameworks/apps/grape_simple.rb
133
134
  - test/frameworks/apps/padrino_simple.rb
134
135
  - test/frameworks/apps/sinatra_simple.rb
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: '0'
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.4.5
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: AppNeta TraceView performance instrumentation gem for Ruby
@@ -194,6 +195,7 @@ test_files:
194
195
  - test/frameworks/apps/sinatra_simple.rb
195
196
  - test/frameworks/apps/padrino_simple.rb
196
197
  - test/frameworks/apps/grape_simple.rb
198
+ - test/frameworks/apps/grape_nested.rb
197
199
  - test/minitest_helper.rb
198
200
  - test/instrumentation/mongo_test.rb
199
201
  - test/instrumentation/redis_hashes_test.rb
@@ -222,3 +224,4 @@ test_files:
222
224
  - test/support/config_test.rb
223
225
  - test/support/xtrace_test.rb
224
226
  - test/support/dnt_test.rb
227
+ has_rdoc: