appsignal-moped 1.0.0.beta.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,6 @@
1
+ [Appsignal](http://appsignal.com) Moped
2
+ ===============
3
+
4
+ This gem is required when using **Mongoid 3.x.x** instead of **ActiveRecord**.
5
+ It adds Mongodb queries instrumentation,
6
+ allowing you to see the impact of mongodb queries made in the monitored app.
@@ -0,0 +1,5 @@
1
+ module Appsignal
2
+ module Moped
3
+ VERSION = '1.0.0.beta.0'
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ require 'moped'
2
+
3
+ module Appsignal
4
+ module Moped
5
+ module Instrumentation
6
+
7
+ private
8
+
9
+ def logging_with_appsignal_instrumentation(operations, &block)
10
+ ActiveSupport::Notifications.instrument(
11
+ 'query.moped', :operations => appsignal_log_operations(operations)
12
+ ) do
13
+ logging_without_appsignal_instrumentation(operations, &block)
14
+ end
15
+ end
16
+
17
+ def appsignal_log_operations(ops)
18
+ ops.map do |op|
19
+ {}.tap do |hash|
20
+ op.instance_variables.reject do |o|
21
+ o == :@full_collection_name
22
+ end.each do |attr|
23
+ value = op.instance_variable_get(attr)
24
+ hash[attr.to_s.gsub('@', '')] = value unless value.nil?
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
34
+ ::Moped::Node.class_eval do
35
+ include Appsignal::Moped::Instrumentation
36
+
37
+ private
38
+
39
+ alias_method :logging_without_appsignal_instrumentation, :logging
40
+ alias_method :logging, :logging_with_appsignal_instrumentation
41
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appsignal-moped
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.beta.0
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Steven Weller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: appsignal
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: moped
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.3.0
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: active_support
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 3.0.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.12.0
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.12.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Log your moped queries with ActiveSupport::Notifications.insturment calls
111
+ email:
112
+ - steven@80beans.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - lib/appsignal_moped/version.rb
118
+ - lib/appsignal_moped.rb
119
+ - README.md
120
+ homepage: https://github.com/80beans/appsignal-moped
121
+ licenses: []
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ segments:
133
+ - 0
134
+ hash: 3594365597414264292
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>'
139
+ - !ruby/object:Gem::Version
140
+ version: 1.3.1
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 1.8.19
144
+ signing_key:
145
+ specification_version: 3
146
+ summary: Add instrument calls to mongodb queries made with moped(or mongoid). For
147
+ use with Appsignal.
148
+ test_files: []