appsignal-moped 1.0.1.beta.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
metadata
CHANGED
@@ -1,96 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal-moped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Steven Weller
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
15
|
+
name: appsignal
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 0.5.0.beta1
|
20
|
-
|
22
|
+
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
|
23
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
27
29
|
version: 0.5.0.beta1
|
28
|
-
none: false
|
29
|
-
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
31
|
+
name: moped
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
32
34
|
requirements:
|
33
35
|
- - ~>
|
34
36
|
- !ruby/object:Gem::Version
|
35
37
|
version: '1.0'
|
36
|
-
|
38
|
+
type: :runtime
|
37
39
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
40
42
|
requirements:
|
41
43
|
- - ~>
|
42
44
|
- !ruby/object:Gem::Version
|
43
45
|
version: '1.0'
|
44
|
-
none: false
|
45
|
-
type: :runtime
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
48
50
|
requirements:
|
49
51
|
- - ! '>='
|
50
52
|
- !ruby/object:Gem::Version
|
51
53
|
version: '0'
|
52
|
-
|
54
|
+
type: :development
|
53
55
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
56
58
|
requirements:
|
57
59
|
- - ! '>='
|
58
60
|
- !ruby/object:Gem::Version
|
59
61
|
version: '0'
|
60
|
-
none: false
|
61
|
-
type: :development
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
64
66
|
requirements:
|
65
67
|
- - ~>
|
66
68
|
- !ruby/object:Gem::Version
|
67
69
|
version: 2.12.0
|
68
|
-
|
70
|
+
type: :development
|
69
71
|
prerelease: false
|
70
|
-
|
71
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
72
74
|
requirements:
|
73
75
|
- - ~>
|
74
76
|
- !ruby/object:Gem::Version
|
75
77
|
version: 2.12.0
|
76
|
-
none: false
|
77
|
-
type: :development
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
79
|
+
name: pry
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
80
82
|
requirements:
|
81
83
|
- - ! '>='
|
82
84
|
- !ruby/object:Gem::Version
|
83
85
|
version: '0'
|
84
|
-
|
86
|
+
type: :development
|
85
87
|
prerelease: false
|
86
|
-
|
87
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
88
90
|
requirements:
|
89
91
|
- - ! '>='
|
90
92
|
- !ruby/object:Gem::Version
|
91
93
|
version: '0'
|
92
|
-
none: false
|
93
|
-
type: :development
|
94
94
|
description: Log your moped queries with ActiveSupport::Notifications.instrument calls
|
95
95
|
email:
|
96
96
|
- steven@80beans.com
|
@@ -99,13 +99,9 @@ extensions: []
|
|
99
99
|
extra_rdoc_files: []
|
100
100
|
files:
|
101
101
|
- lib/appsignal/middleware/moped_event_sanitizer.rb
|
102
|
-
- lib/appsignal/middleware/moped_event_sanitizer.rb~
|
103
102
|
- lib/appsignal/moped/instrumentation.rb
|
104
|
-
- lib/appsignal/moped/instrumentation.rb~
|
105
103
|
- lib/appsignal/moped/version.rb
|
106
|
-
- lib/appsignal/moped/version.rb~
|
107
104
|
- lib/appsignal-moped.rb
|
108
|
-
- lib/appsignal-moped.rb~
|
109
105
|
- README.md
|
110
106
|
homepage: https://github.com/80beans/appsignal-moped
|
111
107
|
licenses: []
|
@@ -114,20 +110,17 @@ rdoc_options: []
|
|
114
110
|
require_paths:
|
115
111
|
- lib
|
116
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
117
114
|
requirements:
|
118
115
|
- - ! '>='
|
119
116
|
- !ruby/object:Gem::Version
|
120
117
|
version: '0'
|
121
|
-
segments:
|
122
|
-
- 0
|
123
|
-
hash: 3384813339710934242
|
124
|
-
none: false
|
125
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
126
120
|
requirements:
|
127
|
-
- - ! '
|
121
|
+
- - ! '>='
|
128
122
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
130
|
-
none: false
|
123
|
+
version: '0'
|
131
124
|
requirements: []
|
132
125
|
rubyforge_project:
|
133
126
|
rubygems_version: 1.8.24
|
data/lib/appsignal-moped.rb~
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'moped'
|
2
|
-
require 'rails'
|
3
|
-
require 'appsignal'
|
4
|
-
require 'appsignal/moped/instrumentation'
|
5
|
-
require 'appsignal/middleware/moped_event_sanitizer'
|
6
|
-
|
7
|
-
::Moped::Node.class_eval do
|
8
|
-
include Appsignal::Moped::Instrumentation
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
alias_method :logging_without_appsignal_instrumentation, :logging
|
13
|
-
alias_method :logging, :logging_with_appsignal_instrumentation
|
14
|
-
end
|
15
|
-
|
16
|
-
Appsignal.post_processing_middleware.add Appsignal::Moped::MopedEventSanitizer
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Appsignal
|
2
|
-
module Middleware
|
3
|
-
class MopedEventSanitizer
|
4
|
-
WHITELISTED_KEYS = %w{fields flags}
|
5
|
-
|
6
|
-
def call(event)
|
7
|
-
if target?(event)
|
8
|
-
event.payload[:ops].each do |operation|
|
9
|
-
operation.each_value do |parameters|
|
10
|
-
selected(parameters).each_value do |value|
|
11
|
-
scrub!(value)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
yield
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
|
21
|
-
def target?(event)
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
def selected(parameters)
|
26
|
-
parameters.reject { |key, value| WHITELISTED_KEYS.include?(key) }
|
27
|
-
end
|
28
|
-
|
29
|
-
def scrub!(value)
|
30
|
-
if value.is_a?(Hash) || value.is_a?(Array)
|
31
|
-
Appsignal::ParamsSanitizer.scrub!(value)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Appsignal
|
2
|
-
module Moped
|
3
|
-
module Instrumentation
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def logging_with_appsignal_instrumentation(operations, &block)
|
8
|
-
ActiveSupport::Notifications.instrument(
|
9
|
-
'query.moped', :ops => appsignal_log_operations(operations)
|
10
|
-
) do
|
11
|
-
logging_without_appsignal_instrumentation(operations, &block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def appsignal_log_operations(ops)
|
16
|
-
ops.map do |op|
|
17
|
-
{
|
18
|
-
operation_name(op) => {}.tap do |hash|
|
19
|
-
op.instance_variables.reject do |o|
|
20
|
-
o == :@full_collection_name
|
21
|
-
end.each do |attr|
|
22
|
-
value = op.instance_variable_get(attr)
|
23
|
-
hash[attr.to_s.gsub('@', '')] = value unless value.nil?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
}
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def operation_name(operation)
|
31
|
-
operation.class.name.split('::').last.tap do |class_name|
|
32
|
-
class_name.gsub!(/([a-z])([A-Z])/,'\1_\2')
|
33
|
-
class_name.downcase!
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|