sidekiq_proby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1edceef2971783dd6f1e5b248190e3d16108ba87
4
+ data.tar.gz: 3ad931dea1839889e2060b95f1363a590cd25dd2
5
+ SHA512:
6
+ metadata.gz: a282a2607c82b1798b3f663e07d1232e572e4b042fd1e23425aeb7d7cd61802d05b9d9822bd4be0e6c9cdeecff79766fb945654fa611be3e66eed9cb648d6fcb
7
+ data.tar.gz: d361174fb4de4a676513eac3b9787f2bf50923a399eb2ec90773472c18bff22ec3c8149523b14c5089fd0675047453339921a6fd403de6dd606cdf23b4c48f1f
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # SidekiqProby
2
+
3
+ Provides a middleware which allows you to monitor the execution of
4
+ sidekiq jobs with proby.
5
+
6
+ This is particular useful when used together with
7
+ [sidetiq](https://github.com/tobiassvn/sidetiq/).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'sidekiq_proby'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sidekiq_proby
22
+
23
+ ## Usage
24
+
25
+ class MyWorker
26
+ include Sidekiq::Worker
27
+ extend SidekiqProby::Trackable
28
+
29
+ proby_task_id 'aasdoibeo125bk3bu3ljoi'
30
+
31
+ def perform
32
+ ...
33
+ end
34
+ end
35
+
36
+ ## Contributing
37
+
38
+ 1. Fork it ( https://github.com/hitfox/sidekiq_proby/fork )
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create a new Pull Request
@@ -0,0 +1,3 @@
1
+ require "sidekiq_proby/version"
2
+ require "sidekiq_proby/trackable"
3
+ require "sidekiq_proby/middleware"
@@ -0,0 +1,21 @@
1
+ require 'proby'
2
+ require 'sidekiq'
3
+ require 'sidekiq_proby/trackable'
4
+
5
+ module SidekiqProby
6
+ class Middleware
7
+ def call(worker, msg, queue, &block)
8
+ if worker.kind_of?(SidekiqProby::Trackable)
9
+ Proby.monitor(worker.class.proby_task_id, &block)
10
+ else
11
+ yield
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ Sidekiq.configure_server do |config|
18
+ config.server_middleware do |chain|
19
+ chain.add SidekiqProby::Middleware
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ module SidekiqProby
2
+ # Public: Mixin for Sidekiq::Worker classes.
3
+ #
4
+ # Examples
5
+ #
6
+ # class MyWorker
7
+ # include Sidekiq::Worker
8
+ # extend SidekiqProby::Trackable
9
+ #
10
+ # proby_task_id 'aasdoibeo125bk3bu3ljoi'
11
+ # end
12
+ module Trackable
13
+ module ClassMethods
14
+ # Public: Gets or sets the proby task id.
15
+ #
16
+ # I decided to go with this kinda weird getter/setter behavier to make the
17
+ # familiar syntax for setting the task id possible.
18
+ def proby_task_id(new_id = nil)
19
+ @proby_task_id = new_id if new_id
20
+ @proby_task_id
21
+ end
22
+ end
23
+
24
+ def self.included(base) # :nodoc:
25
+ super
26
+ base.extend(SidekiqProby::Trackable::ClassMethods)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module SidekiqProby
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sidekiq_proby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Harald Wartig
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sidekiq
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: proby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - hwartig@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - README.md
91
+ - lib/sidekiq_proby.rb
92
+ - lib/sidekiq_proby/middleware.rb
93
+ - lib/sidekiq_proby/trackable.rb
94
+ - lib/sidekiq_proby/version.rb
95
+ homepage: https://github.com/hitfox/sidekiq_proby
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.2.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Proby monitoring for recurring sidekiq jobs.
119
+ test_files: []
120
+ has_rdoc: