app_monit_rails 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/app_monit/rails/config.rb +13 -0
- data/lib/app_monit/rails/railtie.rb +5 -3
- data/lib/app_monit/rails/version.rb +1 -1
- data/lib/app_monit/rails/worker.rb +6 -5
- data/lib/app_monit_rails.rb +1 -0
- data/spec/dummy/config/initializers/app_monit.rb +1 -0
- data/spec/features/trigger_events_spec.rb +4 -7
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03d5fafb91520a7cff4f077ca1e59529f9347b79
|
4
|
+
data.tar.gz: 0ab9267e9d1763eca83c2f9dae22a5826a45b3eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30a433805844c93c78e5ce0766c3268f75e3309ece3ade0be543919e6920eae2110c417127ef79324fc99796beecfc7ef30977278886d9a98aac9f694188c0db
|
7
|
+
data.tar.gz: 845d116ad99b534847cd50f8e0c7ed1fe0cea176bd78e80b337c32f4804e74ff3cee89752941e1d86ac97b626a8d2457c9f20a8b4026e52538b62f72fae41e08
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
module AppMonit
|
2
2
|
module Rails
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
|
-
|
5
|
-
AppMonit::Rails::
|
6
|
-
|
4
|
+
config.after_initialize do |app|
|
5
|
+
if AppMonit::Rails::Config.enabled?
|
6
|
+
AppMonit::Rails::Subscriber.register
|
7
|
+
AppMonit::Rails.logger.debug '[RAILSRUNNER] started'
|
8
|
+
end
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -116,13 +116,14 @@ module AppMonit
|
|
116
116
|
def send_to_collector
|
117
117
|
AppMonit::Rails.logger.debug "Sending to collector"
|
118
118
|
|
119
|
-
events = convert_requests_to_events
|
120
|
-
errors = convert_errors_to_events
|
119
|
+
events = convert_requests_to_events + convert_errors_to_events
|
121
120
|
|
122
|
-
|
121
|
+
if events.any?
|
122
|
+
AppMonit::Http.post('/v1/events', event: events)
|
123
123
|
|
124
|
-
|
125
|
-
|
124
|
+
@requests.clear
|
125
|
+
@errors.clear
|
126
|
+
end
|
126
127
|
|
127
128
|
reset
|
128
129
|
end
|
data/lib/app_monit_rails.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
AppMonit::Rails::Config.enabled = true
|
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
feature 'Triggered events' do
|
4
|
-
|
5
4
|
scenario 'User creates a new Post' do
|
6
|
-
AppMonit::Config.end_point
|
7
|
-
AppMonit::Config.api_key
|
8
|
-
AppMonit::Config.env
|
5
|
+
AppMonit::Config.end_point = 'http://test.local'
|
6
|
+
AppMonit::Config.api_key = 'api_key'
|
7
|
+
AppMonit::Config.env = 'test'
|
9
8
|
|
10
9
|
10.times do
|
11
10
|
visit '/posts/'
|
@@ -37,9 +36,7 @@ feature 'Triggered events' do
|
|
37
36
|
|
38
37
|
@worker = AppMonit::Rails::Worker.instance
|
39
38
|
end
|
40
|
-
AppMonit::Rails::Worker.instance.push(:flush)
|
41
|
-
sleep 1.0
|
42
39
|
|
43
|
-
puts AppMonit::Rails::Worker.instance.requests.
|
40
|
+
puts AppMonit::Rails::Worker.instance.requests.inspect
|
44
41
|
end
|
45
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_monit_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redmar Kerkhoff
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- README.rdoc
|
140
140
|
- Rakefile
|
141
141
|
- appmonit_rails_gem.gemspec
|
142
|
+
- lib/app_monit/rails/config.rb
|
142
143
|
- lib/app_monit/rails/railtie.rb
|
143
144
|
- lib/app_monit/rails/subscriber.rb
|
144
145
|
- lib/app_monit/rails/version.rb
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- spec/dummy/config/environments/development.rb
|
180
181
|
- spec/dummy/config/environments/production.rb
|
181
182
|
- spec/dummy/config/environments/test.rb
|
183
|
+
- spec/dummy/config/initializers/app_monit.rb
|
182
184
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
183
185
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
184
186
|
- spec/dummy/config/initializers/inflections.rb
|
@@ -258,6 +260,7 @@ test_files:
|
|
258
260
|
- spec/dummy/config/environments/development.rb
|
259
261
|
- spec/dummy/config/environments/production.rb
|
260
262
|
- spec/dummy/config/environments/test.rb
|
263
|
+
- spec/dummy/config/initializers/app_monit.rb
|
261
264
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
262
265
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
263
266
|
- spec/dummy/config/initializers/inflections.rb
|