phantom-manager 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/README.md +17 -1
- data/config/config.yml +2 -0
- data/lib/monitors/violations_recorders/response_time.rb +2 -2
- data/lib/phantom/manager/version.rb +1 -1
- data/spec/files/nginx.conf +1 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YThlMjc4YTBhNmVhYTVmM2Q2MzE1OGM0NDM2Mjc2OGM3MDMwZTM0OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTVmZDA5MTBhZTk1ZjFiMjA3NDI5ZmEzMjZmNjlhMTc0YjlmNDFiZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDAyZGI0Mjk4ZDMzYTBkMWEzYWYyYWI5ZjY0MWMyYzA1NTNlMjMyZmUyZjg4
|
10
|
+
YzU1ODM4ZDRkOThlYWIxNzgyM2M0NGY5NWZkNzgxMTYzNjE5NjIzZGQyY2Q4
|
11
|
+
ZWYxNjE1NzE5ZTlkMDIzYjQ3Mjc2MzA4NTA3NzQ0ZjY3MDY1Yjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTVmM2IzY2Y3NzNhNmRlOGNlNTUzYmJhNTBlYzg5NDE2MWEzYmRiNWExZmM2
|
14
|
+
YWRhYTM2Y2RmMzkzNTVlNThlYmYwZDVmNmU5OTQ3MzYwYzdlNDhmYjEyMmE3
|
15
|
+
MWE3YWM2Yjc0MWFmZWViYTc1ZTU1ZDg5OTkzM2Y5ZGJlZjQxMDU=
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,6 +17,7 @@ While:
|
|
17
17
|
|
18
18
|
* Keeping your phantom-js processes running.
|
19
19
|
* Preventing your phantom-js processes from memory-bloat.
|
20
|
+
* Making sure all phantom-js processes are responsive.
|
20
21
|
|
21
22
|
This is a good way to achieve it.
|
22
23
|
|
@@ -74,7 +75,7 @@ upstream phantomjs {
|
|
74
75
|
|
75
76
|
## How Does It Work?
|
76
77
|
|
77
|
-
Phantom manager will check for
|
78
|
+
Phantom manager will check for presence, memory consumption and responsiveness of your
|
78
79
|
phantom-js processes under the configuration you have defined.
|
79
80
|
|
80
81
|
### Presence
|
@@ -99,6 +100,21 @@ memory_check_interval: 5
|
|
99
100
|
The monitor sample all phantom-js processes each 5 seconds and restart those
|
100
101
|
which their memory exceeded 100MB for 3 straight samples.
|
101
102
|
|
103
|
+
### Response Time
|
104
|
+
|
105
|
+
Assuming Configuration:
|
106
|
+
|
107
|
+
```
|
108
|
+
response_time_threshold: 2
|
109
|
+
response_time_check_retries: 2
|
110
|
+
response_time_check_interval: 40
|
111
|
+
```
|
112
|
+
|
113
|
+
The monitor will send an HTTP request to root path (/) of each phantom-js process.
|
114
|
+
If a response is not received within 2 seconds for 2 consecutive samples the
|
115
|
+
process will be restarted.
|
116
|
+
|
117
|
+
|
102
118
|
### Restarting Processes
|
103
119
|
|
104
120
|
To restart a phantom-js process the monitor performs the following actions:
|
data/config/config.yml
CHANGED
@@ -28,12 +28,12 @@ module Monitors
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def check_response_time(process)
|
31
|
-
res = `curl -o /dev/null -s -w %{time_total}@%{http_code} #{process_url(process)}`
|
31
|
+
res = `curl -o /dev/null -s -w %{time_total}@%{http_code} --header "X-Backend-Host: #{Cfg.response_time_check_host}" --header "X-Phantom: true" #{process_url(process)}`
|
32
32
|
res.split("@").first.to_f
|
33
33
|
end
|
34
34
|
|
35
35
|
def process_url(process)
|
36
|
-
"http://localhost:#{process.port}"
|
36
|
+
"http://localhost:#{process.port}#{Cfg.response_time_check_path}"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/spec/files/nginx.conf
CHANGED
@@ -3,12 +3,8 @@ upstream unicorn {
|
|
3
3
|
}
|
4
4
|
|
5
5
|
upstream phantomjs {
|
6
|
-
server 127.0.0.1:
|
7
|
-
server 127.0.0.1:8000 fail_timeout=0; # 2013-10-21 10:44:21 +0200
|
8
|
-
server 127.0.0.1:8012 fail_timeout=0; # 2013-10-21 10:44:21 +0200
|
9
|
-
server 127.0.0.1:8013 fail_timeout=0; # 2013-10-21 10:44:21 +0200
|
6
|
+
server 127.0.0.1:8003 fail_timeout=0; # 2013-12-31 16:03:00 +0200
|
10
7
|
server 127.0.0.1:8002;
|
11
|
-
server 127.0.0.1:8003;
|
12
8
|
server 127.0.0.1:8004;
|
13
9
|
server 127.0.0.1:8005;
|
14
10
|
server 127.0.0.1:8006;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantom-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erez Rabih
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,3 +159,4 @@ test_files:
|
|
159
159
|
- spec/lib/utils/shell_spec.rb
|
160
160
|
- spec/shared_spec.rb
|
161
161
|
- spec/spec_helper.rb
|
162
|
+
has_rdoc:
|