squash_repeater 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c60506271e72774c320843d02b880621d3109a50
4
- data.tar.gz: 30e5660d35d24583c7070b9ac9cd0097b06fbc28
3
+ metadata.gz: ba6dd0117c149134a1b6ebf6fcfdc03e358e5e13
4
+ data.tar.gz: 25fd38a8b755bb537e3215fded0550e21210177d
5
5
  SHA512:
6
- metadata.gz: 5b2eb749252eeda4ad7b9fb8c07a3cf9c99c587c76b025447b15fdb9b2ca264b1ec303d5937cbeff81029d5c803fd6f5e1097e4fa84000f34826c913d3e8e7d7
7
- data.tar.gz: 290abcf712a6da20b90a9ded9d58f8e1f2031b88cecd62149f2a7e82e261bdebfeb0fd18f6246622a5d80cda5a6561c688d6811dfdacd20df306c5f6b4991dab
6
+ metadata.gz: 713119033a8555b7c4ba84f56750127f7e23d7ee669482b9c7e0d20995f3494e95bdee1aa206d8fc49dddfec9f9d24487fe402aea8cb3746e10b7bc607cc68c0
7
+ data.tar.gz: dd6392f9d8b1aa5f2be44501d59a411ca9505f618f4431a8d587ccd905324b827d42d43b922ffce77efe3347d4e1f93fa2d7621f090b7b096f9522dae7d27553
data/README.md CHANGED
@@ -1,22 +1,19 @@
1
1
  # SquashRepeater
2
2
 
3
- One difficulty with Squash is that whenever any exception occurs, it contacts the
4
- Squash server to upload details of that failure, which means the code blocks until
5
- contact is made or the connection times-out.
6
-
7
- In many cases, an exception is a failure, and you probably don't want to be nice
8
- about it, but for user-facing app's, you're degrading the user-experience even
9
- further. A quick-response "failure" message to the user is still many times better
10
- than waiting many seconds (or more).
11
-
12
- On top of that, almost all exceptions are valuable, in that they have captured a
13
- failure-mode that you weren't previously aware of. If the server is down, then the
14
- chances are that data is lost.
15
-
16
- Squash Repeater uses a low-overhead queueing service to capture any exceptions and
17
- return control as quickly as possible, after which an independent "worker" process
18
- will attempt to send the queued exception reports to the Squash server.
19
- This should mean:
3
+ One difficulty with Squash is that whenever any exception occurs, it contacts the Squash server to
4
+ upload details of that failure, which means the code blocks until contact is made or the connection
5
+ times-out.
6
+
7
+ In many cases, an exception is a failure, and you probably don't want to be nice about it, but for
8
+ user-facing app's, you're degrading the user-experience even further. A quick-response "failure"
9
+ message to the user is still many times better than waiting many seconds (or more).
10
+
11
+ On top of that, almost all exceptions are valuable, in that they have captured a failure-mode that
12
+ you weren't previously aware of. If the server is down, then the chances are that data is lost.
13
+
14
+ Squash Repeater uses a low-overhead queueing service to capture any exceptions and return control as
15
+ quickly as possible, after which an independent "worker" process will attempt to send the queued
16
+ exception reports to the Squash server. This should mean:
20
17
  - the local Squash client code can return far more quickly
21
18
  - any exception reports that fail to be accepted by the Squash server aren't lost
22
19
  (or dropped from the queue)
@@ -39,11 +36,15 @@ And then execute:
39
36
 
40
37
  Or install it yourself as:
41
38
 
42
- $ gem install squash_repeater
39
+ ```bash
40
+ $ gem install squash_repeater
41
+ ```
43
42
 
44
43
  If you're using Rails, you can install an initialiser template with:
45
44
 
46
- $ bundle exec rails generate squash_repeater:install
45
+ ```bash
46
+ $ bundle exec rails generate squash_repeater:install
47
+ ```
47
48
 
48
49
  ## Install `beanstalkd`
49
50
 
@@ -53,30 +54,47 @@ If you're using Rails, you can install an initialiser template with:
53
54
 
54
55
  ## Configure `backburner`
55
56
 
56
- `backburner` is the Gem used to interact with the `beanstalk` queue.
57
- It works in two parts: client libraries that put data on the queue, and background-worker jobs that process the data on
58
- queue.
57
+ `backburner` is the Gem used to interact with the `beanstalk` queue. It works in two parts: client
58
+ libraries that put data on the queue, and background-worker jobs that process the data on queue.
59
59
 
60
60
  Simply adding the Gem to your app will configure the client part with useful defaults.
61
61
 
62
- To enable the background-worker part, you need to be able to automatically start the `backburner` worker.
63
- The `backburner` Gem documentation covers this is detail, but they include a God script.
62
+ To enable the background-worker part, you need to be able to automatically start the `backburner`
63
+ worker. The `backburner` Gem documentation covers this in detail, but they include a God script.
64
+
65
+ I've included a set of example Ubuntu Upstart scripts in the `share/upstart` directory, which you
66
+ will need to update with details like "app_name" and "app_dir" and install to your machine's
67
+ `/etc/init/` dir. You may also need to make other adjustments to it according to your needs and/or
68
+ skill.
69
+
70
+ Alternatively, you can either start the SquashRepeater worker directly with `rails runner`:
64
71
 
65
- I've included a set of example Ubuntu Upstart scripts in the `share/upstart` directory, which you will need to update
66
- with details like "app_name" and "app_dir" and install to your machine's `/etc/init/` dir.
67
- You may also need to make other adjustments to it according to your needs and/or skill.
72
+ ```bash
73
+ $ cd ${app_dir}
74
+ $ bundle exec rails runner SquashRepeater.work
75
+ ```
68
76
 
69
- Alternatively, you can either start `backburner` in daemon mode with:
77
+ Or wrapped with some other daemoniser (such as Niet) with:
70
78
 
71
- $ cd ${app_dir}
72
- $ bundle exec backburner -d -r ${app_config}
79
+ ```bash
80
+ $ niet -k 30 -t SquashRepeater -c ${app_dir} -- bundle exec rails runner SquashRepeater.work
81
+ ```
73
82
 
74
- Or wrapped with some-other daemoniser (such as Niet) with:
83
+ Or, start `backburner` in daemon mode with:
75
84
 
76
- $ niet -t backburner -c ${app_dir} -- bundle exec backburner -r ${app_config}
85
+ ```bash
86
+ $ cd ${app_dir}
87
+ $ bundle exec backburner -d -r ${app_config}
88
+ ```
77
89
 
78
- NB: Replace ${app_dir} with the directory your app is installed to, and ${app_config} with the path to your Squash
79
- Repeater config.
90
+ Or with a daemoniser:
91
+
92
+ ```bash
93
+ $ niet -t backburner -c ${app_dir} -- bundle exec backburner -r ${app_config}
94
+ ```
95
+
96
+ NB: Replace ${app_dir} with the directory your app is installed to, and ${app_config} with the path
97
+ to your Squash Repeater config.
80
98
 
81
99
  ## Configure Squash Repeater
82
100
 
@@ -97,7 +115,6 @@ SquashRepeater.configure do |c|
97
115
  #c.backburner.max_job_retries = 10 # retry jobs 10 times
98
116
  #c.backburner.retry_delay = 30 # wait 30 seconds in between retries
99
117
 
100
-
101
118
  ###
102
119
  # You can set Squash::Ruby config here, or through their configration method. Either way, they must be set:
103
120
  # @param api_host:
@@ -116,8 +133,8 @@ SquashRepeater.configure do |c|
116
133
  end
117
134
  ```
118
135
 
119
- As mentioned above, you can configure a few `Squash::Ruby` settings via this config block, or configure it in the Squash
120
- way via `Squash::Ruby.configure()`
136
+ As mentioned above, you can configure a few `Squash::Ruby` settings via this config block, or
137
+ configure it in the Squash way via `Squash::Ruby.configure()`
121
138
 
122
139
  ## Contributing
123
140
 
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "squash_repeater"
5
+
6
+ class SquashRepeater::CLI < Thor
7
+ # contents of the Thor class
8
+ desc "transmitter", "Start a worker that sends all queued captured exceptions to the Squash service"
9
+ option :beanstalk_host, :type => :string
10
+ option :beanstalk_port, :type => :numeric
11
+ option :beanstalk_tube, :type => :string
12
+ def transmitter
13
+ SquashRepeater.configure do |c|
14
+ beanstalk_url = nil
15
+
16
+ beanstalk_url = "beanstalk://#{options[:beanstalk_host]}" if options[:beanstalk_host]
17
+ beanstalk_url += ":#{options[:beanstalk_port]}" if beanstalk_url && options[:beanstalk_port]
18
+ c.backburner.beanstalk_url = beanstalk_url if beanstalk_url
19
+
20
+ c.backburner.tube_namespace = options[:beanstalk_tube] if options[:beanstalk_tube]
21
+ end
22
+
23
+ SquashRepeater.configuration.logger.info "Starting SquashRepeater worker"
24
+
25
+ SquashRepeater.transmit_exceptions
26
+ end
27
+ end
28
+
29
+ SquashRepeater::CLI.start(ARGV)
@@ -1,3 +1,3 @@
1
1
  module SquashRepeater
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squash_repeater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Robertson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-28 00:00:00.000000000 Z
11
+ date: 2015-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,7 +125,8 @@ dependencies:
125
125
  description: Use beanstalkd to locally queue and repeat Squash exception capturing.
126
126
  email:
127
127
  - will.robertson@powershop.co.nz
128
- executables: []
128
+ executables:
129
+ - squash_repeater
129
130
  extensions: []
130
131
  extra_rdoc_files: []
131
132
  files:
@@ -134,6 +135,7 @@ files:
134
135
  - LICENSE.txt
135
136
  - README.md
136
137
  - Rakefile
138
+ - bin/squash_repeater
137
139
  - lib/generators/squash_repeater/install_generator.rb
138
140
  - lib/generators/templates/squash_repeater_initializer.rb
139
141
  - lib/squash_repeater.rb