dynoscale_ruby 1.0.1 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e345e1b86543193c0c74bb99d95a9dcc689328c306d658f00028d07781ed53ce
4
- data.tar.gz: d279fc98ebb9e52b5184bc7070abf37113d4c8e69195d875ac399582d179b352
3
+ metadata.gz: 47759854ca94fb24bcc0c11bb4cf235b09bd027abf24542420c05c8df01d3dcb
4
+ data.tar.gz: 19adb7b1704ba702cc07644e119b9121447db1a37f571a1eb06abc97fb84319b
5
5
  SHA512:
6
- metadata.gz: c309a0e91e54b7c15e97e7a2e226baf0dbedac4ab9f08c9ebcbf2af7780ffaf35cec855785a45cb65590ddc48280cc0e57993cab35519469d490c654662324b6
7
- data.tar.gz: c5484500c166a50f91117800e4ddf828053a7a195b8832b831388586a3358b7a0d79067e5267e67544dd3f7a9121bf27326203b9f5a3bb6960f35f0fd142f546
6
+ metadata.gz: 7334f837342defdbd850785a60e3d743bac517b616fdda060d3b57d73d25d5741f4eaa396d4ce898bacf391fec795f4acbe4cb2ab4e5dbcb5893c2615b06193a
7
+ data.tar.gz: c83206d6e393aed982ec43a34f48dd1b75c692337acad334ca7cd62b71aa28284d10aa7553b7c7fdea4dda3ebffa9f2bc339d1791ea485fd9d32e84682e7c782
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynoscale_ruby (1.0.0)
4
+ dynoscale_ruby (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Dynoscale Ruby
2
2
 
3
- #### Simple yet efficient scaling agent for Ruby/Rails apps on Heroku
3
+ #### Simple yet efficient scaling agent for Ruby/Rails apps on Heroku. A better [heroku autoscaling](https://dynoscale.net/blog/why-is-queue-time-more-important-than-backend-request-time-to-auto-scaling) alternative.
4
4
 
5
5
  ## Getting Started
6
6
 
@@ -11,6 +11,10 @@
11
11
 
12
12
  The environment variable `DYNOSCALE_URL` must be set in order for your application to communicate with Dynoscale Servers.
13
13
 
14
+ ## Status
15
+
16
+ [![Gem Version](https://badge.fury.io/rb/dynoscale_ruby.svg)](https://badge.fury.io/rb/dynoscale_ruby)
17
+
14
18
  ## Non-Rails Rack Based Apps
15
19
 
16
20
  In addition to the above steps, you will need to `require 'dynoscale_ruby/middleware'` and add the `DynoscaleRuby::Middleware` before the `Rack::Runtime` in your application.
@@ -25,6 +29,18 @@ In addition to the above steps, you will need to `require 'dynoscale_ruby/middle
25
29
 
26
30
  In addition to Web scaling, Dynoscale collects data on Worker jobs too. At this time Sidekiq and Resque are currently supported.
27
31
 
32
+ ## Why use Dynoscale?
33
+
34
+ Some blog posts about why Dynoscale is a helpful tool.
35
+
36
+ * [Why is Queue Time more important than Backend Request Time to auto scaling?](https://dynoscale.net/blog/why-is-queue-time-more-important-than-backend-request-time-to-auto-scaling)
37
+ * [How to setup heroku autoscaling in under 15 minutes?](https://dynoscale.net/blog/how-to-setup-heroku-autoscaling-in-under-15-minutes)
38
+ * [Level up your Heroku autoscaling in 15 minutes](http://localhost:5008/blog/level-up-your-heroku-autoscaling-in-15-minutes)
39
+
40
+ ## Skip Dynoscale Agent
41
+
42
+ In review apps, staging or development environments, set the `SKIP_DYNOSCALE_AGENT` environment variable to disable the scaling agent on all web and worker processes.
43
+
28
44
  ## Contributing
29
45
 
30
46
  Bug reports and pull requests are welcome on GitHub at https://github.com/Mjolnir-Software/dynoscale_ruby.
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  "source_code_uri" => "https://github.com/Mjolnir-Software/dynoscale_ruby",
20
20
  }
21
21
 
22
- spec.version = '1.0.1'
22
+ spec.version = '1.0.3'
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
25
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
@@ -19,14 +19,15 @@ module DynoscaleRuby
19
19
  end
20
20
 
21
21
  def call(env)
22
+ return @app.call(env) if ENV['SKIP_DYNOSCALE_AGENT']
23
+
22
24
  is_dev = ENV['DYNOSCALE_DEV'] == 'true'
23
25
  dyno = is_dev ? "dev.1" : ENV['DYNO']
24
26
 
25
27
  unless ENV['DYNOSCALE_URL']
26
28
  puts "Missing DYNOSCALE_URL environment variable"
27
29
  return @app.call(env)
28
- end
29
- return @app.call(env) if ENV['SKIP_DYNASCALE_AGENT']
30
+ end
30
31
  return @app.call(env) unless is_dev || ENV['DYNO']&.split(".")&.last == "1"
31
32
 
32
33
  request_calculator = RequestCalculator.new(env)
@@ -28,7 +28,7 @@ module DynoscaleRuby
28
28
  if worker.enabled?
29
29
  queue_latencies = worker.queue_latencies
30
30
  queue_latencies.each do |queue, latency, depth|
31
- @@current_report.add_measurement(current_time, latency, "#{worker.name}:#{queue}", nil)
31
+ @@current_report&.add_measurement(current_time, latency, "#{worker.name}:#{queue}", nil)
32
32
  Logger.logger.debug "#{worker.name.capitalize} worker measurement #{current_time}, #{latency} recorded in report."
33
33
  end
34
34
  end
@@ -6,6 +6,8 @@ module DynoscaleRuby
6
6
  include Singleton
7
7
 
8
8
  def self.enabled?
9
+ return false if ENV['SKIP_DYNOSCALE_AGENT']
10
+
9
11
  require 'resque'
10
12
  require 'resque_latency'
11
13
  true
@@ -29,4 +31,3 @@ module DynoscaleRuby
29
31
  end
30
32
  end
31
33
  end
32
-
@@ -6,6 +6,8 @@ module DynoscaleRuby
6
6
  include Singleton
7
7
 
8
8
  def self.enabled?
9
+ return false if ENV['SKIP_DYNOSCALE_AGENT']
10
+
9
11
  require 'sidekiq/api'
10
12
  true
11
13
  rescue LoadError
@@ -27,4 +29,4 @@ module DynoscaleRuby
27
29
  end
28
30
  end
29
31
  end
30
- end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynoscale_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Abrahamsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-23 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: