alacrity-rails 0.0.5 → 0.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c88ed9a4d29666c56e4774bee5fd88f98a75c7
|
4
|
+
data.tar.gz: ea9691cc259bb58290eda6599e0dfbe891e12c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0b5b65ab606e19a7c0ec11d1bbef16ce75117ea21f1f19759279970c60a49cba43bd52ad947e1eadcc0b9843f1a53f6db8dc5fdb4d59ded409ee4b9ceb84c5
|
7
|
+
data.tar.gz: 5379d118ad2471f2eeb696f9f5c01927500f54afed8146d0bd1cd02ddd85b7b394699c03a91a2761d8cf2921b6555c3aa1c844d05f129df84313c31af72a0fd2
|
data/lib/alacrity-rails.rb
CHANGED
@@ -11,6 +11,10 @@ module AlacrityRails
|
|
11
11
|
autoload :ServerConfig, 'alacrity-rails/server_config'
|
12
12
|
autoload :VERSION, 'alacrity-rails/version'
|
13
13
|
|
14
|
+
module Probe
|
15
|
+
autoload :MongoDriver, 'alacrity-rails/probe/mongo_driver'
|
16
|
+
end
|
17
|
+
|
14
18
|
module Transaction
|
15
19
|
autoload :Base, 'alacrity-rails/transaction/base'
|
16
20
|
autoload :ConnectionTest, 'alacrity-rails/transaction/connection_test'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AlacrityRails
|
2
|
+
module Probe
|
3
|
+
class MongoDriver
|
4
|
+
def started(event)
|
5
|
+
@command = {}
|
6
|
+
event.command.each do |key, value|
|
7
|
+
@command[key] = value.respond_to?(:keys) ? value.keys : value
|
8
|
+
end
|
9
|
+
@started = DateTime.now
|
10
|
+
end
|
11
|
+
|
12
|
+
def succeeded(event)
|
13
|
+
finished = DateTime.now
|
14
|
+
data = {
|
15
|
+
name: "#{event.database_name}.#{event.command_name}",
|
16
|
+
sql: @command.to_s
|
17
|
+
}
|
18
|
+
AlacrityRails::Client.store_database_metrics(@started, finished, data)
|
19
|
+
@command = @started = nil
|
20
|
+
end
|
21
|
+
alias failed succeeded
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -13,6 +13,10 @@ module AlacrityRails
|
|
13
13
|
ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |name, started, finished, unique_id, data|
|
14
14
|
AlacrityRails::Client.store_request_metrics(started, finished, data)
|
15
15
|
end
|
16
|
+
|
17
|
+
if defined?(Mongo)
|
18
|
+
Mongo::Monitoring::Global.subscribe(Mongo::Monitoring::COMMAND, AlacrityRails::Probe::MongoDriver.new)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module AlacrityRails::Transaction
|
2
2
|
class WebTransaction < Base
|
3
3
|
attr_accessor :url, :middleware_started_at, :controller, :action, :format,
|
4
|
-
:method, :status, :
|
5
|
-
:framework_finished_at
|
4
|
+
:method, :status, :framework_started_at, :framework_finished_at
|
6
5
|
|
7
6
|
def initialize(env={})
|
8
7
|
self.middleware_started_at = absolute_time(DateTime.now)
|
@@ -26,8 +25,6 @@ module AlacrityRails::Transaction
|
|
26
25
|
self.action = data[:action]
|
27
26
|
self.format = data[:format]
|
28
27
|
self.status = data[:status]
|
29
|
-
self.view_runtime = data[:view_runtime].try(:to_i)
|
30
|
-
self.db_runtime = data[:db_runtime].try(:to_i)
|
31
28
|
end
|
32
29
|
|
33
30
|
def as_json(*args)
|
@@ -45,8 +42,6 @@ module AlacrityRails::Transaction
|
|
45
42
|
format: format,
|
46
43
|
method: method,
|
47
44
|
status: status,
|
48
|
-
view_runtime: view_runtime,
|
49
|
-
db_runtime: db_runtime,
|
50
45
|
sql_queries: sql_queries
|
51
46
|
}
|
52
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alacrity-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alacrity, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/alacrity-rails/config.rb
|
40
40
|
- lib/alacrity-rails/connection_tester.rb
|
41
41
|
- lib/alacrity-rails/middleware.rb
|
42
|
+
- lib/alacrity-rails/probe/mongo_driver.rb
|
42
43
|
- lib/alacrity-rails/railtie.rb
|
43
44
|
- lib/alacrity-rails/server_config.rb
|
44
45
|
- lib/alacrity-rails/transaction/base.rb
|