dynoscale_ruby 1.0.2 → 1.0.4

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: 07ef9352043479ecadcc703ee8b1ca093ac305efd99943c4a473ddfe2cd18e12
4
- data.tar.gz: 43944936c1bdf3a18c36ecdf89692c1d644aa79339d9a94c028cee12f40bf6f0
3
+ metadata.gz: 0a08f6a14f17bdbcee0b037a2f4ba6b7e643a04210069f8fc6ba16cd273ddfe1
4
+ data.tar.gz: daad354cc06b1add88a15c7b89f55de3c6bf593797a6f0b7e977cb2852b2b3ac
5
5
  SHA512:
6
- metadata.gz: 6aabed0d63014683ecd7a663ff57be7b4f37d60c14ca82b6596800656f8f22e37658b3f4c3cb5a676a25e8d2d60187b90c366b645fb40ea79bc4750ad978ebd6
7
- data.tar.gz: 4996cfb58220558a12c16d6cce6bd23a36a36e3435cff84f48214892a107dd508e275d8360d594b9a99c25022a66a156ce9d7c3bfb8a9677080860e0a5bf8b7a
6
+ metadata.gz: 2e21d89a50f2776c656f72315330aa71225fb2fda301281a253f743b4f417ffde214ff53b12cbb2d562831d26645f85544bff1032565d807213ecd77017ff733
7
+ data.tar.gz: db8d0d2f2b3bcab189bcf8beb97b61e35ad701b923ef4c65c28ba495a0526cfc6876a3afdb2561ea495a1072c0822f0dcb4ac1f264416d1ffa368ce94cd4121a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynoscale_ruby (1.0.2)
4
+ dynoscale_ruby (1.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -37,6 +37,10 @@ Some blog posts about why Dynoscale is a helpful tool.
37
37
  * [How to setup heroku autoscaling in under 15 minutes?](https://dynoscale.net/blog/how-to-setup-heroku-autoscaling-in-under-15-minutes)
38
38
  * [Level up your Heroku autoscaling in 15 minutes](http://localhost:5008/blog/level-up-your-heroku-autoscaling-in-15-minutes)
39
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
+
40
44
  ## Contributing
41
45
 
42
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.2'
22
+ spec.version = '1.0.4'
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)
@@ -20,7 +20,7 @@ module DynoscaleRuby
20
20
  @@current_report ||= Report.new(current_time + REPORT_RECORDING_FREQ)
21
21
 
22
22
  if queue_time
23
- @@current_report.add_measurement(current_time, queue_time, 'web', nil)
23
+ @@current_report&.add_measurement(current_time, queue_time, 'web', nil)
24
24
  Logger.logger.debug "Web measurement #{current_time}, #{queue_time} recorded in report."
25
25
  end
26
26
 
@@ -35,7 +35,7 @@ module DynoscaleRuby
35
35
  end
36
36
 
37
37
  @@reports ||= {}
38
- @@reports[@@current_report.publish_timestamp] = @@current_report
38
+ @@reports[@@current_report&.publish_timestamp] = @@current_report
39
39
  @@reports.values
40
40
  end
41
41
 
@@ -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.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Abrahamsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-30 00:00:00.000000000 Z
11
+ date: 2024-05-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: