oboe 2.7.9.lynx1 → 2.7.9.6

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: d32f3c0a9bf9e1b7c6a633ea89f02d00b27706da
4
- data.tar.gz: 282619b82dda020f3c4c05460d4836945034b086
3
+ metadata.gz: e5859ef94398356f7e7dd4f4450c8821a2ddce97
4
+ data.tar.gz: 6afd531338153c13140f600fde8fc5e00e333523
5
5
  SHA512:
6
- metadata.gz: 6d5973ba9dd280ceaf46b29e1520d22a7daff3d79ba707f2d113a44082fdb8bbe937f7c8b2af6fda1907c7903547ea30845cc4a86dc5d8079fcdcb3a80b7c0cd
7
- data.tar.gz: 2a9f1e99bd92629e76a49289534e85c9c83ed370042e984ed018a54e0ff9a58a6faac4a44265a9d4a58f94c3ffb3c4e0773970e424ebfcfc2d7a41b72ff2d220
6
+ metadata.gz: d38e17a4c07d147135a802fa07ea216dcfcf406132aad1466814380451f56fb4efc2ca19d14082491a25c70fd152befb78a1aab79e64747e2a35e83e41c24d1e
7
+ data.tar.gz: 6735017cfcab74c864628fa6359c05b428c5fd2344a2d007d58e355635795aaa3677e08be51ea0b59932b12065f2b91dbdc6d220508a9cecefe1b25fa08c1459
data/.travis.yml CHANGED
@@ -21,7 +21,8 @@ rvm:
21
21
  # Attempt Travis/Cassandra fix re: https://github.com/travis-ci/travis-ci/issues/1484
22
22
  # Updated Cassandra: https://github.com/travis-ci/travis-ci/issues/1650
23
23
  before_install:
24
- - gem update --system 2.1.11
24
+ - gem update --system
25
+ - gem update bundler
25
26
  - gem --version
26
27
  - sudo sh -c "echo 'JVM_OPTS=\"\${JVM_OPTS} -Djava.net.preferIPv4Stack=false\"' >> /usr/local/cassandra/conf/cassandra-env.sh"
27
28
  - echo "127.0.0.1 localhost" | sudo tee /etc/hosts
data/Gemfile CHANGED
@@ -10,11 +10,11 @@ end
10
10
  group :development do
11
11
  gem 'ruby-debug', :platforms => [ :mri_18, :jruby ]
12
12
  gem 'debugger', :platform => :mri_19
13
- gem 'byebug', :platforms => [ :mri_20, :mri_21 ]
13
+ gem 'byebug', :platforms => [ :mri_20, :mri_21, :mri_22 ]
14
14
  # gem 'perftools.rb', :platforms => [ :mri_20, :mri_21 ], :require => 'perftools'
15
15
  if RUBY_VERSION > '1.8.7'
16
16
  gem 'pry'
17
- gem 'pry-byebug', :platforms => [ :mri_20, :mri_21 ]
17
+ gem 'pry-byebug', :platforms => [ :mri_20, :mri_21, :mri_22 ]
18
18
  else
19
19
  gem 'pry', '0.9.12.4'
20
20
  end
data/lib/joboe_metal.rb CHANGED
@@ -82,7 +82,7 @@ module Oboe_metal
82
82
  # Only report __Init from here if we are not instrumenting a framework.
83
83
  # Otherwise, frameworks will handle reporting __Init after full initialization
84
84
  unless defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape)
85
- Oboe::API.report_init
85
+ Oboe::API.report_init unless ENV.key?('OBOE_GEM_TEST')
86
86
  end
87
87
  end
88
88
 
@@ -46,7 +46,7 @@ module Oboe
46
46
  return if !Oboe.loaded || exn.instance_variable_get(:@oboe_logged)
47
47
 
48
48
  kvs = { :ErrorClass => exn.class.name,
49
- :Message => exn.message,
49
+ :ErrorMsg => exn.message,
50
50
  :Backtrace => exn.backtrace.join("\r\n") }
51
51
 
52
52
  exn.instance_variable_set(:@oboe_logged, true)
@@ -52,38 +52,36 @@ module Oboe
52
52
  report_kvs = {}
53
53
  report_kvs[:URL] = URI.unescape(req.path)
54
54
 
55
- # Under JRuby, JOboe may have already started a trace. Make note of this
56
- # if so and don't clear context on log_end (see oboe/api/logging.rb)
57
- Oboe.has_incoming_context = Oboe.tracing?
58
-
59
55
  # Check for and validate X-Trace request header to pick up tracing context
60
56
  xtrace = env.is_a?(Hash) ? env['HTTP_X_TRACE'] : nil
61
57
  xtrace_header = xtrace if xtrace && Oboe::XTrace.valid?(xtrace)
62
- Oboe.has_xtrace_header = xtrace_header
63
58
 
59
+ # Under JRuby, JOboe may have already started a trace. Make note of this
60
+ # if so and don't clear context on log_end (see oboe/api/logging.rb)
61
+ Oboe.has_incoming_context = Oboe.tracing?
62
+ Oboe.has_xtrace_header = xtrace_header
64
63
  Oboe.is_continued_trace = Oboe.has_incoming_context or Oboe.has_xtrace_header
65
64
 
66
- # The actual block of work to instrument
67
- result, xtrace = Oboe::API.start_trace('rack', xtrace_header, report_kvs) do
68
- status, headers, response = @app.call(env)
65
+ Oboe::API.log_start('rack', xtrace_header, report_kvs)
66
+ report_kvs = collect(req, env) if Oboe.tracing?
69
67
 
70
- if Oboe.tracing?
71
- report_kvs = collect(req, env)
72
- Oboe::API.log(nil, 'info', report_kvs.merge!(:Status => status))
73
- end
68
+ status, headers, response = @app.call(env)
74
69
 
75
- [status, headers, response]
70
+ if Oboe.tracing?
71
+ xtrace = Oboe::API.log_end('rack', report_kvs.merge!(:Status => status))
76
72
  end
73
+
74
+ [status, headers, response]
77
75
  rescue Exception => e
78
- xtrace = e.instance_variable_get(:@xtrace)
76
+ Oboe::API.log_exception('rack', e)
77
+ xtrace = Oboe::API.log_end('rack', report_kvs.merge!(:Status => 500))
79
78
  raise
80
79
  ensure
81
- if result && Oboe::XTrace.valid?(xtrace)
80
+ if headers && Oboe::XTrace.valid?(xtrace)
82
81
  unless defined?(JRUBY_VERSION) && Oboe.is_continued_trace?
83
- result[1]['X-Trace'] = xtrace if result[1].is_a?(Hash)
82
+ headers['X-Trace'] = xtrace if headers.is_a?(Hash)
84
83
  end
85
84
  end
86
- return result
87
85
  end
88
86
  end
89
87
  end
@@ -28,10 +28,6 @@ module Oboe
28
28
  kvs[:HTTPStatus] = response.code
29
29
  kvs['Backtrace'] = Oboe::API.backtrace if Oboe::Config[:typhoeus][:collect_backtraces]
30
30
 
31
- # Avoid cross host tracing for blacklisted domains
32
- # Conditionally add the X-Trace header to the outgoing request
33
- response.headers['X-Trace'] = context unless blacklisted
34
-
35
31
  uri = URI(response.effective_url)
36
32
  kvs['IsService'] = 1
37
33
  kvs['RemoteProtocol'] = uri.scheme
data/lib/oboe/version.rb CHANGED
@@ -9,7 +9,7 @@ module Oboe
9
9
  MAJOR = 2
10
10
  MINOR = 7
11
11
  PATCH = 9
12
- BUILD = "lynx1"
12
+ BUILD = 6
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
15
15
  end
data/lib/oboe_metal.rb CHANGED
@@ -27,7 +27,7 @@ module Oboe
27
27
  # Only report __Init from here if we are not instrumenting a framework.
28
28
  # Otherwise, frameworks will handle reporting __Init after full initialization
29
29
  unless defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape)
30
- Oboe::API.report_init
30
+ Oboe::API.report_init unless ENV.key?('OBOE_GEM_TEST')
31
31
  end
32
32
 
33
33
  rescue => e
@@ -1,9 +1,20 @@
1
1
  require 'grape'
2
2
 
3
3
  class GrapeSimple < Grape::API
4
+ rescue_from :all do |e|
5
+ error_response({ message: "rescued from #{e.class.name}" })
6
+ end
4
7
 
5
8
  get '/json_endpoint' do
6
9
  present({ :test => true })
7
10
  end
11
+
12
+ get "/break" do
13
+ raise Exception.new("This should have http status code 500!")
14
+ end
15
+
16
+ get "/breakstring" do
17
+ raise "This should have http status code 500!"
18
+ end
8
19
  end
9
20
 
@@ -27,6 +27,10 @@ SimpleDemo.controllers do
27
27
  get "/render" do
28
28
  render :erb, "This is an erb render"
29
29
  end
30
+
31
+ get "/break" do
32
+ raise "This is a controller exception!"
33
+ end
30
34
  end
31
35
 
32
36
  ## If you want use this as a standalone app uncomment:
@@ -14,6 +14,10 @@ class SinatraSimple < Sinatra::Base
14
14
  get "/render" do
15
15
  render :erb, "This is an erb render"
16
16
  end
17
+
18
+ get "/break" do
19
+ raise "This is a controller exception!"
20
+ end
17
21
  end
18
22
 
19
23
  use SinatraSimple
@@ -12,6 +12,32 @@ if RUBY_VERSION >= '1.9.3'
12
12
 
13
13
  r = get "/json_endpoint"
14
14
 
15
+ traces = get_all_traces
16
+ traces.count.must_equal 4
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 "exit"
25
+
26
+ # Validate the existence of the response header
27
+ r.headers.key?('X-Trace').must_equal true
28
+ r.headers['X-Trace'].must_equal traces[3]['X-Trace']
29
+ end
30
+
31
+ it "should trace a request with an error" do
32
+ @app = GrapeSimple
33
+
34
+ begin
35
+ r = get "/break"
36
+ rescue Exception => e
37
+ # Do not handle/raise this error so
38
+ # we can continue to test
39
+ end
40
+
15
41
  traces = get_all_traces
16
42
  traces.count.must_equal 5
17
43
 
@@ -21,7 +47,10 @@ if RUBY_VERSION >= '1.9.3'
21
47
  traces[2]['Layer'].must_equal "grape"
22
48
  traces[2].has_key?('Controller').must_equal true
23
49
  traces[2].has_key?('Action').must_equal true
24
- traces[3]['Label'].must_equal "info"
50
+ traces[3]['Label'].must_equal "error"
51
+ traces[3]['ErrorClass'].must_equal "Exception"
52
+ traces[3]['ErrorMsg'].must_equal "This should have http status code 500!"
53
+ traces[4]['Label'].must_equal "exit"
25
54
  end
26
55
  end
27
56
  end
@@ -13,13 +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 9
16
+ traces.count.must_equal 8
17
17
 
18
18
  validate_outer_layers(traces, 'rack')
19
19
 
20
20
  traces[1]['Layer'].must_equal "padrino"
21
21
  traces[6]['Controller'].must_equal "SimpleDemo"
22
- traces[7]['Label'].must_equal "info"
22
+ traces[7]['Label'].must_equal "exit"
23
+
24
+ # Validate the existence of the response header
25
+ r.headers.key?('X-Trace').must_equal true
26
+ r.headers['X-Trace'].must_equal traces[7]['X-Trace']
23
27
  end
24
28
  end
25
29
  end
@@ -12,14 +12,18 @@ describe Sinatra do
12
12
  r = get "/render"
13
13
 
14
14
  traces = get_all_traces
15
- traces.count.must_equal 9
15
+ traces.count.must_equal 8
16
16
 
17
17
  validate_outer_layers(traces, 'rack')
18
18
 
19
19
  traces[1]['Layer'].must_equal "sinatra"
20
20
  traces[3]['Label'].must_equal "profile_entry"
21
21
  traces[6]['Controller'].must_equal "SinatraSimple"
22
- traces[7]['Label'].must_equal "info"
22
+ traces[7]['Label'].must_equal "exit"
23
+
24
+ # Validate the existence of the response header
25
+ r.headers.key?('X-Trace').must_equal true
26
+ r.headers['X-Trace'].must_equal traces[7]['X-Trace']
23
27
  end
24
28
  end
25
29
 
@@ -111,7 +111,7 @@ if RUBY_VERSION < '2.0' and not defined?(JRUBY_VERSION)
111
111
  traces[1]['KVKey'].must_equal "testKey"
112
112
 
113
113
  traces[2]['ErrorClass'].must_equal "Memcached::NotStored"
114
- traces[2]['Message'].must_equal "Memcached::NotStored"
114
+ traces[2]['ErrorMsg'].must_equal "Memcached::NotStored"
115
115
  end
116
116
 
117
117
  it "should trace append" do
@@ -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 3
27
+ traces.count.must_equal 2
28
28
 
29
29
  validate_outer_layers(traces, 'rack')
30
30
 
@@ -33,7 +33,7 @@ class RackTestApp < Minitest::Test
33
33
  validate_event_keys(traces[0], kvs)
34
34
 
35
35
  kvs.clear
36
- kvs["Label"] = "info"
36
+ kvs["Label"] = "exit"
37
37
  kvs["Status"] = "200"
38
38
  kvs["HTTP-Host"] = "example.org"
39
39
  kvs["Port"] = "80"
@@ -1,4 +1,5 @@
1
1
  require 'minitest_helper'
2
+ require 'rack'
2
3
 
3
4
  describe Oboe::Inst::TyphoeusRequestOps do
4
5
  before do
@@ -48,7 +49,7 @@ describe Oboe::Inst::TyphoeusRequestOps do
48
49
 
49
50
  it 'should trace a typhoeus POST request' do
50
51
  Oboe::API.start_trace('typhoeus_test') do
51
- Typhoeus.post("https://internal.tv.appneta.com/api-v2/log_message",
52
+ Typhoeus.post("https://internal.tv.appneta.com/api-v2/log_message",
52
53
  :body => { :key => "oboe-ruby-fake", :content => "oboe-ruby repo test suite"})
53
54
  end
54
55
 
@@ -76,7 +77,7 @@ describe Oboe::Inst::TyphoeusRequestOps do
76
77
 
77
78
  it 'should trace a typhoeus PUT request' do
78
79
  Oboe::API.start_trace('typhoeus_test') do
79
- Typhoeus.put("https://internal.tv.appneta.com/api-v2/log_message",
80
+ Typhoeus.put("https://internal.tv.appneta.com/api-v2/log_message",
80
81
  :body => { :key => "oboe-ruby-fake", :content => "oboe-ruby repo test suite"})
81
82
  end
82
83
 
@@ -181,6 +182,58 @@ describe Oboe::Inst::TyphoeusRequestOps do
181
182
  traces[3]['Label'].must_equal 'exit'
182
183
  end
183
184
 
185
+ it 'should trace a typhoeus GET request to an internal app' do
186
+ # TODO: JRuby doesn't trace the inner rack app for some reason...
187
+ skip if defined?(JRUBY_VERSION)
188
+
189
+ Thread.new do
190
+ app = Rack::Builder.new {
191
+ use Oboe::Rack
192
+ run Proc.new { |env|
193
+ [200, {"Content-Type" => "text/html"}, ['Hello, world!']]
194
+ }
195
+ }
196
+
197
+ Rack::Handler::WEBrick.run(app, :Port => 8000)
198
+ end
199
+
200
+ sleep(1)
201
+
202
+ Oboe::API.start_trace('outer') do
203
+ res = Typhoeus.get("127.0.0.1:8000/")
204
+ end
205
+
206
+ traces = get_all_traces
207
+ traces.count.must_equal 7
208
+
209
+ validate_outer_layers(traces, 'outer')
210
+
211
+ traces[2]['Layer'].must_equal 'rack'
212
+ traces[2]['Label'].must_equal 'entry'
213
+ traces[3]['Layer'].must_equal 'rack'
214
+ traces[3]['Label'].must_equal 'exit'
215
+
216
+ # Verify typhoeus info edges to inner exit
217
+ traces[5]['Edge'].must_equal traces[4]['X-Trace'][42...58]
218
+
219
+ # Verify typhoeus events
220
+ traces[1]['Layer'].must_equal 'typhoeus'
221
+ traces[1].key?('Backtrace').must_equal Oboe::Config[:typhoeus][:collect_backtraces]
222
+
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
+ traces[5]['Layer'].must_equal 'typhoeus'
234
+ traces[5]['Label'].must_equal 'exit'
235
+ end
236
+
184
237
  it 'should trace a typhoeus GET request with DNS error' do
185
238
  Oboe::API.start_trace('typhoeus_test') do
186
239
  Typhoeus.get("thisdomaindoesntexisthopefully.asdf/products/traceview/")
@@ -32,7 +32,7 @@ unless defined?(JRUBY_VERSION)
32
32
  get "/lobster"
33
33
 
34
34
  traces = get_all_traces
35
- traces.count.must_equal 3
35
+ traces.count.must_equal 2
36
36
 
37
37
  validate_outer_layers(traces, 'rack')
38
38
 
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.9.lynx1
4
+ version: 2.7.9.6
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-01-21 00:00:00.000000000 Z
12
+ date: 2015-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -177,9 +177,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  version: 1.8.6
178
178
  required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - ">"
180
+ - - ">="
181
181
  - !ruby/object:Gem::Version
182
- version: 1.3.1
182
+ version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
185
  rubygems_version: 2.4.5