copperegg-apm 1.0.0.pre11 → 1.0.0.pre12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/copperegg-apm.gemspec +1 -0
- data/copperegg_apm_test.db +0 -0
- data/lib/copperegg/apm/exception_capturer.rb +3 -5
- data/lib/copperegg/apm/version.rb +1 -1
- data/spec/action_controller_spec.rb +39 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4313fab8e77ab385dea7347df5a08b45afac975
|
4
|
+
data.tar.gz: 6a609b051cf3944274e61b6c9952bf88f8c7b8fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94840a8bfcc2ea8f9ce4fc4136f215874a91581401b2a079735a5fdf8678ff082488a09d22fc4fefbf2627ac5cbf6f4c4f1611c0fc52e46f6827ae3676691d7b
|
7
|
+
data.tar.gz: 8541bada34ccf547940bb757423f02659c60f3f1ec62d61bb7017eee973eab870219494c73a9b475cd0ace8978eed2b1ef2ec14a23e6d5481bb6f53425c9edf8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
copperegg-apm (1.0.0.
|
4
|
+
copperegg-apm (1.0.0.pre12)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -94,6 +94,7 @@ DEPENDENCIES
|
|
94
94
|
mysql (~> 2.9)
|
95
95
|
mysql2 (~> 0.2)
|
96
96
|
pg (~> 0.9)
|
97
|
+
rack-test (~> 0.6)
|
97
98
|
rake (~> 10.0.0)
|
98
99
|
rest-client (~> 1.6)
|
99
100
|
rspec (~> 2.11.0)
|
data/copperegg-apm.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency 'rake', '~> 10.0.0'
|
23
23
|
s.add_development_dependency 'rspec', '~> 2.11.0'
|
24
24
|
s.add_development_dependency 'rspec-rails', '~> 2.0'
|
25
|
+
s.add_development_dependency 'rack-test', '~> 0.6'
|
25
26
|
s.add_development_dependency 'actionpack', '~> 3.0'
|
26
27
|
s.add_development_dependency 'faker', '~> 1.1.2'
|
27
28
|
s.add_development_dependency 'mysql', '~> 2.9'
|
data/copperegg_apm_test.db
CHANGED
Binary file
|
@@ -9,12 +9,10 @@ module CopperEgg
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
begin
|
13
12
|
@app.call(env)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
13
|
+
rescue Exception => e
|
14
|
+
CopperEgg::APM.capture_exception(e)
|
15
|
+
raise e
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Props to @relishapp (http://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/anonymous-controller) and
|
2
|
+
# @AlexandrZaytsev (http://say26.com/rspec-testing-controllers-outside-of-a-rails-application) for their helpful blog posts
|
3
|
+
require File.dirname(__FILE__) + '/helpers/rails'
|
4
|
+
require 'spec_helper'
|
5
|
+
require 'rack/test'
|
6
|
+
|
7
|
+
RSpec.configure do |c|
|
8
|
+
c.infer_base_class_for_anonymous_controllers = true
|
9
|
+
end
|
10
|
+
|
11
|
+
class ApplicationController < ActionController::Base
|
12
|
+
include Rails.application.routes.url_helpers
|
13
|
+
include Rack::Test::Methods
|
14
|
+
end
|
15
|
+
|
16
|
+
class ExceptionController < ApplicationController; end
|
17
|
+
|
18
|
+
describe ExceptionController, :type => :controller do
|
19
|
+
controller(ExceptionController) do
|
20
|
+
def index
|
21
|
+
@count = 1/0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should instrument all exceptions not rescued" do
|
26
|
+
expect { get :index, {:id => 1, :sort => "name"} }.to raise_error
|
27
|
+
|
28
|
+
# last_payload = CopperEgg::APM.send(:class_variable_get, :@@payload_cache).split("\x00").select {|i| i.size > 2}.map {|i| i.sub(/^[^\{]+/,'')}.last
|
29
|
+
# hash = JSON.parse last_payload
|
30
|
+
|
31
|
+
# expect(hash.keys.sort).to eq ["excp", "id"]
|
32
|
+
# expect(hash["id"]).to match(/\A[0-1a-z]{16}\z/i)
|
33
|
+
# expect(hash["excp"].keys.sort).to eq ["error", "stacktrace", "ts"]
|
34
|
+
# expect(hash["excp"]["error"]).to match(/\AZeroDivisionError\|/)
|
35
|
+
# expect(hash["excp"]["error"]).to match(/\{Ruby\}\Z/)
|
36
|
+
# expect(hash["excp"]["stacktrace"]).to match(/\Adivided by 0\n/)
|
37
|
+
# expect(hash["excp"]["ts"]).to be_an_instance_of(Fixnum)
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copperegg-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bradford
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: actionpack
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -222,6 +236,7 @@ files:
|
|
222
236
|
- ./README.md
|
223
237
|
- ./screenshot01.png
|
224
238
|
- ./screenshot02.png
|
239
|
+
- ./spec/action_controller_spec.rb
|
225
240
|
- ./spec/apm_spec.rb
|
226
241
|
- ./spec/ethon_spec.rb
|
227
242
|
- ./spec/helpers/mysql2_setup.rb
|
@@ -241,6 +256,7 @@ files:
|
|
241
256
|
- README.md
|
242
257
|
- Rakefile
|
243
258
|
- copperegg-apm.gemspec
|
259
|
+
- spec/action_controller_spec.rb
|
244
260
|
- spec/apm_spec.rb
|
245
261
|
- spec/ethon_spec.rb
|
246
262
|
- spec/helpers/mysql2_setup.rb
|
@@ -288,8 +304,9 @@ rubyforge_project:
|
|
288
304
|
rubygems_version: 2.0.3
|
289
305
|
signing_key:
|
290
306
|
specification_version: 4
|
291
|
-
summary: copperegg-apm-1.0.0.
|
307
|
+
summary: copperegg-apm-1.0.0.pre12
|
292
308
|
test_files:
|
309
|
+
- spec/action_controller_spec.rb
|
293
310
|
- spec/apm_spec.rb
|
294
311
|
- spec/ethon_spec.rb
|
295
312
|
- spec/helpers/mysql2_setup.rb
|