faye_audit 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +18 -3
- data/faye_audit.gemspec +2 -2
- data/lib/faye_audit/version.rb +1 -1
- data/lib/faye_audit.rb +21 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 826233a5fd97882682eebc080ae71cde58b16e5b
|
4
|
+
data.tar.gz: 07c31fd8fe0db5d1588af768115be509d34e3431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2a4d6b15be5bd02c202754f5f14044abe2152f0d47b86cbb15a67c578b85a80be383af4f66b7b1e3ddbfd895670674f9d90dbfdfea85ac5fd88ec871e7e1820
|
7
|
+
data.tar.gz: 234d4a32592b350577d9a03307541fbc052d1af4d7e2df403cfd7f95156cb339bb99622565455c1ca308a475752a5a0a2dd04cc46f65245db3e4329e0327524b
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [0.3.0](https://github.com/ShallmentMo/faye_audit/tree/0.3.0) (2016-04-25)
|
4
|
+
[Full Changelog](https://github.com/ShallmentMo/faye_audit/compare/0.2.0...0.3.0)
|
5
|
+
|
6
|
+
Try to inspect into `bayeux` to get the `client_count` and `channel_count`.
|
7
|
+
> Warning!! might have efficiency problem
|
8
|
+
|
9
|
+
|
10
|
+
## [0.2.0](https://github.com/ShallmentMo/faye_audit/tree/0.2.0) (2016-04-24)
|
11
|
+
|
12
|
+
Log infomation when every monitor event triggers.
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# FayeAudit
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Try to audit Faye server
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -39,6 +37,23 @@ run faye
|
|
39
37
|
|
40
38
|
```
|
41
39
|
|
40
|
+
And you will get something like this:
|
41
|
+
|
42
|
+
```
|
43
|
+
faye: { client_count: 1, channel_count: 0 }
|
44
|
+
handshake:
|
45
|
+
client_id: fi5zawstsmsj1kc7wig6n6jz5s3n7rp
|
46
|
+
|
47
|
+
faye: { client_count: 1, channel_count: 1 }
|
48
|
+
subscribe:
|
49
|
+
client_id: fi5zawstsmsj1kc7wig6n6jz5s3n7rp
|
50
|
+
channel: /server
|
51
|
+
```
|
52
|
+
|
53
|
+
## TODO
|
54
|
+
|
55
|
+
Because I try to inspect into bayeux, so it might have efficiency problem. And logger to file can be slow. I should working on it.
|
56
|
+
|
42
57
|
## Development
|
43
58
|
|
44
59
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/faye_audit.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "minitest"
|
24
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
25
25
|
|
26
|
-
spec.add_dependency "faye"
|
26
|
+
spec.add_dependency "faye", "~> 1.1"
|
27
27
|
end
|
data/lib/faye_audit/version.rb
CHANGED
data/lib/faye_audit.rb
CHANGED
@@ -9,15 +9,32 @@ module FayeAudit
|
|
9
9
|
@@logger = logger
|
10
10
|
end
|
11
11
|
|
12
|
+
def client_count
|
13
|
+
@@bayeux.instance_variable_get(:@server)
|
14
|
+
.instance_variable_get(:@engine)
|
15
|
+
.instance_variable_get(:@engine)
|
16
|
+
.instance_variable_get(:@clients).keys.size
|
17
|
+
end
|
18
|
+
|
19
|
+
def channel_count
|
20
|
+
@@bayeux.instance_variable_get(:@server)
|
21
|
+
.instance_variable_get(:@engine)
|
22
|
+
.instance_variable_get(:@engine)
|
23
|
+
.instance_variable_get(:@channels).size
|
24
|
+
end
|
25
|
+
|
12
26
|
def audit(bayeux)
|
27
|
+
@@bayeux = bayeux
|
13
28
|
bayeux.on(:handshake) do |client_id|
|
14
29
|
logger.info <<LOG
|
30
|
+
faye: { client_count: #{client_count + 1}, channel_count: #{channel_count} }
|
15
31
|
handshake:
|
16
32
|
client_id: #{client_id}
|
17
33
|
LOG
|
18
34
|
end
|
19
35
|
bayeux.on(:subscribe) do |client_id, channel|
|
20
36
|
logger.info <<LOG
|
37
|
+
faye: { client_count: #{client_count}, channel_count: #{channel_count} }
|
21
38
|
subscribe:
|
22
39
|
client_id: #{client_id}
|
23
40
|
channel: #{channel}
|
@@ -25,6 +42,7 @@ LOG
|
|
25
42
|
end
|
26
43
|
bayeux.on(:unsubscribe) do |client_id, channel|
|
27
44
|
logger.info <<LOG
|
45
|
+
faye: { client_count: #{client_count}, channel_count: #{channel_count} }
|
28
46
|
unsubscribe:
|
29
47
|
client_id: #{client_id}
|
30
48
|
channel: #{channel}
|
@@ -32,6 +50,7 @@ LOG
|
|
32
50
|
end
|
33
51
|
bayeux.on(:publish) do |client_id, channel, data|
|
34
52
|
logger.info <<LOG
|
53
|
+
faye: { client_count: #{client_count}, channel_count: #{channel_count} }
|
35
54
|
publish:
|
36
55
|
client_id: #{client_id}
|
37
56
|
channel: #{channel}
|
@@ -40,11 +59,12 @@ LOG
|
|
40
59
|
end
|
41
60
|
bayeux.on(:disconnect) do |client_id|
|
42
61
|
logger.info <<LOG
|
62
|
+
faye: { client_count: #{client_count}, channel_count: #{channel_count} }
|
43
63
|
disconnect:
|
44
64
|
client_id: #{client_id}
|
45
65
|
LOG
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
49
|
-
module_function :audit, :logger, :logger
|
69
|
+
module_function :audit, :logger, :logger=, :client_count, :channel_count
|
50
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faye_audit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShallmentMo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faye
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.1'
|
69
69
|
description: Audit faye in every monitoring event
|
70
70
|
email:
|
71
71
|
- ShallmentMo@gmail.com
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".travis.yml"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|