leviathan-rails 0.0.1.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ ---
2
+ subscriptions:
3
+ - hello_world
4
+ - render_template.action_view
5
+ - render_partial.action_view
6
+ - sql.active_record
@@ -0,0 +1,37 @@
1
+ require 'socket'
2
+ require 'rubygems'
3
+ require 'msgpack'
4
+ require 'yaml'
5
+ require 'activesupport'
6
+ require 'activesupport_notifications_backport'
7
+
8
+ APP_ROOT = File.dirname(__FILE__)
9
+
10
+ module Leviathan
11
+ def self.connection
12
+ @connection
13
+ end
14
+
15
+ def self.connection=(value)
16
+ @connection = value
17
+ end
18
+
19
+ def self.initialize_subscriptions(connection)
20
+ self::connection = connection
21
+
22
+ config = YAML.load_file(File.join(APP_ROOT, 'config/subscriptions.yml'))
23
+
24
+ config['subscriptions'].each do |x|
25
+ ActiveSupport::Notifications.subscribe x do |*args|
26
+ Leviathan::notify(connection, args)
27
+ end
28
+ end
29
+ end
30
+
31
+ def self.notify(connection, args)
32
+ e = ActiveSupport::Notifications::Event.new(*args)
33
+ message = e.payload.to_msgpack
34
+
35
+ UDPSocket.new.send message, 0, connection[:host], connection[:port]
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leviathan-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Brian Pina
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport_notifications_backport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.4
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.0.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: msgpack
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '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: '0'
46
+ description: Socket pusher for ActiveSupport::Notifications
47
+ email: brian.pina@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - lib/leviathan-rails.rb
53
+ - lib/config/subscriptions.yml
54
+ homepage: https://github.com/bpina/leviathan-rails
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>'
70
+ - !ruby/object:Gem::Version
71
+ version: 1.3.1
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.25
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: Rails Monitoring Gem
78
+ test_files: []