mnemosyne-ruby 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +24 -9
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/lib/mnemosyne.rb +1 -0
- data/lib/mnemosyne/middleware/rack.rb +14 -11
- data/lib/mnemosyne/middleware/sidekiq.rb +3 -0
- data/lib/mnemosyne/probes/action_dispatch/show_exceptions.rb +29 -0
- data/lib/mnemosyne/probes/msgr/consumer.rb +3 -0
- data/lib/mnemosyne/trace.rb +28 -4
- data/lib/mnemosyne/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dd6477917eee07e244adbce53f2f07b23ee2a8a
|
4
|
+
data.tar.gz: 6bfaf7fa6a1a5beb52ccedc769ceb72483dd7d1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cf8bf8db8c95be6c4a40e7ad68d7303a49737c46f405d6bb67e282b7bf32371038d8a0c274df94f4476158605fd5470308f13af0b3fedc480a3af3df294aa38
|
7
|
+
data.tar.gz: 24fbef4b46867c7511611e1152cdd4ddd5616ffb2f7a7434332ed57288fc5fbaf8f7d16cef65b69f55c5efebd57891a7b831135a972f539a4746a6f8859ea305
|
data/.travis.yml
CHANGED
@@ -1,14 +1,29 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
|
+
sudo: required
|
4
|
+
services:
|
5
|
+
- rabbitmq
|
3
6
|
rvm:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
+
- 2.4.2
|
8
|
+
- 2.3.4
|
9
|
+
- 2.2.6
|
7
10
|
before_install:
|
8
|
-
|
9
|
-
|
11
|
+
- gem update --system
|
12
|
+
- gem install bundler
|
10
13
|
script:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
- bundle exec rake rubocop
|
15
|
+
- bundle exec rake spec
|
16
|
+
jobs:
|
17
|
+
include:
|
18
|
+
- stage: Release
|
19
|
+
rvm: 2.4.2
|
20
|
+
install: skip
|
21
|
+
script: skip
|
22
|
+
deploy:
|
23
|
+
provider: rubygems
|
24
|
+
api_key:
|
25
|
+
secure: GDEAmZLPOYQOsMJRrAcyRIrdOdbkZ5iM0Z9OHjxMwLkHtnR8XcfjNzPdXEji6o1nQaS3PfcLIdpEmis6FJqT4aXRU0F/1VwHAgiYIe3NWs5rFEo2dWS0ScfeQJQ1rY2inq/ayp3r01/eUTVVwhks8hresBlZrT6HR2Jub300lkhJQoAwHB44cekTZrv3PSTpyMhHOBUjk8bpx2m0n/dGM3lOYlAnaL4DA1l6/JdoYNS3hbyphZFnymS4cl5QIxF6NRNlC6uEzmZ0Hr4dK0amnBwUeillqxgAWiYQXyj/do7r1iXdrtORidIb3QfGAhsuxZY9Cu6+E8CfhwvnnY5ElpGrDvlVTBV4hyfudsRq87QwTS64c62dQ7s1cvcMxJcYMfWDyaFkYmGoXN0QCrN9M9JhrXh8sLKAFQIMsc2kH8dyuhlIJXvIZVzdxtey8geOYBwalB8DJl7BM/nbG/LuEagpahJco4k0/+3KDxxMFRplMG4ShkOw/otousiVlsu7idszpgxuVPrVAwAbhIPxJV0i1Ak0Vt/nohkR2DOxdf4E40jDrP2d2A4DMVKU8R92BDH8Qj/nle20TeL/Wx2/3mLBAIH+stUtKILnpwoWEfVhe+Ys3LLEaDtYBLcOr4W9czlFH43GxctbBMiadVQAVBQOIUOTkA84gADFLCIOCA0=
|
26
|
+
gem: mnemosyne-ruby
|
27
|
+
on:
|
28
|
+
tags: true
|
29
|
+
repo: jgraichen/mnemosyne-ruby
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/mnemosyne.rb
CHANGED
@@ -30,6 +30,7 @@ module Mnemosyne
|
|
30
30
|
require 'mnemosyne/probes/acfs/request'
|
31
31
|
require 'mnemosyne/probes/action_controller/process_action'
|
32
32
|
require 'mnemosyne/probes/action_controller/renderers'
|
33
|
+
require 'mnemosyne/probes/action_dispatch/show_exceptions'
|
33
34
|
require 'mnemosyne/probes/action_view/render_partial'
|
34
35
|
require 'mnemosyne/probes/action_view/render_template'
|
35
36
|
require 'mnemosyne/probes/active_record/query'
|
@@ -4,9 +4,9 @@ module Mnemosyne
|
|
4
4
|
module Middleware
|
5
5
|
class Rack
|
6
6
|
class Proxy
|
7
|
-
def initialize(body,
|
7
|
+
def initialize(body, trace)
|
8
8
|
@body = body
|
9
|
-
@
|
9
|
+
@trace = trace
|
10
10
|
@closed = false
|
11
11
|
end
|
12
12
|
|
@@ -33,7 +33,7 @@ module Mnemosyne
|
|
33
33
|
begin
|
34
34
|
@body.close if @body.respond_to? :close
|
35
35
|
ensure
|
36
|
-
@
|
36
|
+
@trace.submit
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -42,11 +42,10 @@ module Mnemosyne
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def each(*args)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
45
|
+
@body.each(*args, &Proc.new)
|
46
|
+
rescue StandardError, LoadError, SyntaxError => e
|
47
|
+
@trace.attach_error(e)
|
48
|
+
raise
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
@@ -73,13 +72,17 @@ module Mnemosyne
|
|
73
72
|
|
74
73
|
scan_response(trace, response)
|
75
74
|
|
76
|
-
response[2] = Proxy.new(response[2]
|
75
|
+
response[2] = Proxy.new(response[2], trace)
|
77
76
|
response
|
78
77
|
else
|
79
78
|
@app.call env
|
80
79
|
end
|
81
|
-
rescue
|
82
|
-
|
80
|
+
rescue StandardError, LoadError, SyntaxError => e
|
81
|
+
if trace
|
82
|
+
trace.attach_error(e)
|
83
|
+
trace.submit
|
84
|
+
end
|
85
|
+
|
83
86
|
raise
|
84
87
|
ensure
|
85
88
|
trace.release if trace
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mnemosyne
|
4
|
+
module Probes
|
5
|
+
module ActionDispatch
|
6
|
+
module ShowExceptions
|
7
|
+
class Probe < ::Mnemosyne::Probe
|
8
|
+
def setup
|
9
|
+
::ActionDispatch::ShowExceptions.send :prepend, Instrumentation
|
10
|
+
end
|
11
|
+
|
12
|
+
module Instrumentation
|
13
|
+
def render_exception(env, exception)
|
14
|
+
if (trace = ::Mnemosyne::Instrumenter.current_trace)
|
15
|
+
trace.attach_error(exception)
|
16
|
+
end
|
17
|
+
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
register 'ActionDispatch::ShowExceptions',
|
26
|
+
'action_dispatch/middleware/show_exceptions',
|
27
|
+
ActionDispatch::ShowExceptions::Probe.new
|
28
|
+
end
|
29
|
+
end
|
data/lib/mnemosyne/trace.rb
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
module Mnemosyne
|
4
4
|
class Trace < Span
|
5
|
-
attr_reader :uuid, :transaction, :origin, :span
|
5
|
+
attr_reader :uuid, :transaction, :origin, :span, :errors
|
6
6
|
|
7
7
|
def initialize(instrumenter, name, transaction: nil, origin: nil, **kwargs)
|
8
8
|
super(name, **kwargs)
|
9
9
|
|
10
|
-
@uuid
|
11
|
-
@span
|
10
|
+
@uuid = ::SecureRandom.uuid
|
11
|
+
@span = []
|
12
|
+
@errors = []
|
12
13
|
|
13
14
|
@origin = origin
|
14
15
|
@transaction = transaction
|
@@ -20,6 +21,10 @@ module Mnemosyne
|
|
20
21
|
@span << span
|
21
22
|
end
|
22
23
|
|
24
|
+
def attach_error(error)
|
25
|
+
@errors << Error.new(error)
|
26
|
+
end
|
27
|
+
|
23
28
|
def submit
|
24
29
|
finish! unless finish
|
25
30
|
|
@@ -39,8 +44,27 @@ module Mnemosyne
|
|
39
44
|
start: start,
|
40
45
|
stop: finish,
|
41
46
|
meta: meta,
|
42
|
-
span: @span.map(&:serialize)
|
47
|
+
span: @span.map(&:serialize),
|
48
|
+
errors: @errors.map(&:serialize)
|
43
49
|
}
|
44
50
|
end
|
51
|
+
|
52
|
+
Error = Struct.new(:error) do
|
53
|
+
BT_REGEXP = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/
|
54
|
+
|
55
|
+
# rubocop:disable AbcSize
|
56
|
+
def serialize
|
57
|
+
{
|
58
|
+
type: error.class.name,
|
59
|
+
text: error.message,
|
60
|
+
stacktrace: error.backtrace.map do |bt|
|
61
|
+
md = BT_REGEXP.match(bt.to_s).to_a
|
62
|
+
|
63
|
+
{file: md[1], line: md[2], call: md[3], raw: md[0]}
|
64
|
+
end
|
65
|
+
}
|
66
|
+
end
|
67
|
+
# rubocop:enable all
|
68
|
+
end
|
45
69
|
end
|
46
70
|
end
|
data/lib/mnemosyne/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mnemosyne-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/mnemosyne/probes/acfs/request.rb
|
141
141
|
- lib/mnemosyne/probes/action_controller/process_action.rb
|
142
142
|
- lib/mnemosyne/probes/action_controller/renderers.rb
|
143
|
+
- lib/mnemosyne/probes/action_dispatch/show_exceptions.rb
|
143
144
|
- lib/mnemosyne/probes/action_view/render_partial.rb
|
144
145
|
- lib/mnemosyne/probes/action_view/render_template.rb
|
145
146
|
- lib/mnemosyne/probes/active_record/query.rb
|