rails_autoscale_agent 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +2 -1
- data/lib/rails_autoscale_agent/config.rb +2 -1
- data/lib/rails_autoscale_agent/reporter.rb +8 -14
- data/lib/rails_autoscale_agent/store.rb +1 -0
- data/lib/rails_autoscale_agent/version.rb +1 -1
- data/lib/rails_autoscale_agent/worker_adapters/delayed_job.rb +2 -2
- data/lib/rails_autoscale_agent/worker_adapters/que.rb +2 -2
- data/lib/rails_autoscale_agent/worker_adapters/resque.rb +2 -2
- data/lib/rails_autoscale_agent/worker_adapters/sidekiq.rb +2 -2
- data/rails_autoscale_agent.gemspec +11 -3
- metadata +12 -8
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f313cab3eefd93584c9d2484698d836ad19467b2e03cd26623003edcd1c64ad5
|
4
|
+
data.tar.gz: d8b33799b6dc0c2e92b6fbe770de41ac7e104a8d887965cf35538ea9ab6b8acb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3208e51e66e87a9c5e076322c04f7f3594295d11ad2e5c16cdea5600372e02b70e50e15138788fe5d59a7d6854a8c59c908db5cdb28878386989c7e8fb2d9049
|
7
|
+
data.tar.gz: 1b771752c5fde1c3cd534a4ef2aca0e5917d3343d10e97cfb5fdb64a89f72cd5343e4662af281c214a35459cb77759f7c19b5110fd8bed979b54ffeff97a1de0
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
2
2
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
3
3
|
|
4
|
-
## [Unreleased](https://github.com/adamlogic/rails_autoscale_agent/compare/v0.
|
4
|
+
## [Unreleased](https://github.com/adamlogic/rails_autoscale_agent/compare/v0.11.0...master)
|
5
5
|
|
6
6
|
No currently unreleased changes.
|
7
7
|
|
8
|
+
## [0.11.0](https://github.com/adamlogic/rails_autoscale_agent/compare/v0.10.2...v0.11.0)
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Add `RAILS_AUTOSCALE_MAX_QUEUES` config option. ([28738a5](https://github.com/adamlogic/rails_autoscale_agent/commit/28738a5dc4cd6b0a46e77459d6f98e6b33072da9))
|
13
|
+
|
8
14
|
## [0.10.2](https://github.com/adamlogic/rails_autoscale_agent/compare/v0.10.1...v0.10.2) - 2021-01-12
|
9
15
|
|
10
16
|
### Changed
|
data/README.md
CHANGED
@@ -43,8 +43,9 @@ Rails Autoscale aggregates and stores this information to power the autoscaling
|
|
43
43
|
Most Rails Autoscale configurations are handled via the settings page on your Rails Autoscale dashboard, but there a few ways you can directly change the behavior of the agent via environment variables:
|
44
44
|
|
45
45
|
- `RAILS_AUTOSCALE_DEBUG` - Enables debug logging. See more in the [logging](#logging) section below.
|
46
|
-
- `RAILS_AUTOSCALE_WORKER_ADAPTER` - Overrides the available worker adapters. See more in the [worker adapters](#
|
46
|
+
- `RAILS_AUTOSCALE_WORKER_ADAPTER` - Overrides the available worker adapters. See more in the [worker adapters](#worker-adapters) section below.
|
47
47
|
- `RAILS_AUTOSCALE_LONG_JOBS` - Enables reporting for active workers. See [Handling Long-Running Background Jobs](https://railsautoscale.com/docs/long-running-jobs/) in the Rails Autoscale docs for more.
|
48
|
+
- `RAILS_AUTOSCALE_MAX_QUEUES` - Worker metrics will only report up to 50 queues by default. If you have more than 50 queues, you'll need to configure this settings or reduce your number of queues.
|
48
49
|
|
49
50
|
## Worker adapters
|
50
51
|
|
@@ -10,7 +10,7 @@ module RailsAutoscaleAgent
|
|
10
10
|
|
11
11
|
attr_accessor :report_interval, :logger, :api_base_url, :max_request_size,
|
12
12
|
:dyno, :addon_name, :worker_adapters, :dev_mode, :debug, :quiet,
|
13
|
-
:track_long_running_jobs,
|
13
|
+
:track_long_running_jobs, :max_queues,
|
14
14
|
|
15
15
|
# legacy configs, no longer used
|
16
16
|
:sidekiq_latency_for_active_jobs, :latency_for_active_jobs
|
@@ -24,6 +24,7 @@ module RailsAutoscaleAgent
|
|
24
24
|
@dev_mode = ENV['RAILS_AUTOSCALE_DEV'] == 'true'
|
25
25
|
@debug = dev_mode? || ENV['RAILS_AUTOSCALE_DEBUG'] == 'true'
|
26
26
|
@track_long_running_jobs = ENV['RAILS_AUTOSCALE_LONG_JOBS'] == 'true'
|
27
|
+
@max_queues = ENV.fetch('RAILS_AUTOSCALE_MAX_QUEUES', 50).to_i
|
27
28
|
@max_request_size = 100_000 # ignore request payloads over 100k since they skew the queue times
|
28
29
|
@report_interval = 10 # this default will be overwritten during Reporter#register!
|
29
30
|
@logger ||= defined?(Rails) ? Rails.logger : ::Logger.new(STDOUT)
|
@@ -6,8 +6,6 @@ require 'rails_autoscale_agent/autoscale_api'
|
|
6
6
|
require 'rails_autoscale_agent/time_rounder'
|
7
7
|
require 'rails_autoscale_agent/registration'
|
8
8
|
|
9
|
-
# Reporter wakes up every minute to send metrics to the RailsAutoscale API
|
10
|
-
|
11
9
|
module RailsAutoscaleAgent
|
12
10
|
class Reporter
|
13
11
|
include Singleton
|
@@ -56,20 +54,16 @@ module RailsAutoscaleAgent
|
|
56
54
|
def report!(config, store)
|
57
55
|
report = store.pop_report
|
58
56
|
|
59
|
-
|
60
|
-
logger.info "Reporting #{report.measurements.size} measurements"
|
57
|
+
logger.info "Reporting #{report.measurements.size} measurements"
|
61
58
|
|
62
|
-
|
63
|
-
|
59
|
+
params = report.to_params(config)
|
60
|
+
result = AutoscaleApi.new(config).report_metrics!(params, report.to_csv)
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
else
|
72
|
-
logger.debug "Reporter has nothing to report"
|
62
|
+
case result
|
63
|
+
when AutoscaleApi::SuccessResponse
|
64
|
+
logger.debug "Reported successfully"
|
65
|
+
when AutoscaleApi::FailureResponse
|
66
|
+
logger.error "Reporter failed: #{result.failure_message}"
|
73
67
|
end
|
74
68
|
end
|
75
69
|
|
@@ -33,8 +33,8 @@ module RailsAutoscaleAgent
|
|
33
33
|
run_at_by_queue = Hash[select_rows(sql)]
|
34
34
|
|
35
35
|
# Don't collect worker metrics if there are unreasonable number of queues
|
36
|
-
if run_at_by_queue.size >
|
37
|
-
logger.
|
36
|
+
if run_at_by_queue.size > Config.instance.max_queues
|
37
|
+
logger.warn "Skipping DelayedJob metrics - #{run_at_by_queue.size} queues exceeds the #{Config.instance.max_queues} queue limit"
|
38
38
|
return
|
39
39
|
end
|
40
40
|
|
@@ -40,8 +40,8 @@ module RailsAutoscaleAgent
|
|
40
40
|
run_at_by_queue = Hash[select_rows(sql)]
|
41
41
|
|
42
42
|
# Don't collect worker metrics if there are unreasonable number of queues
|
43
|
-
if run_at_by_queue.size >
|
44
|
-
logger.
|
43
|
+
if run_at_by_queue.size > Config.instance.max_queues
|
44
|
+
logger.warn "Skipping Que metrics - #{run_at_by_queue.size} queues exceeds the #{Config.instance.max_queues} queue limit"
|
45
45
|
return
|
46
46
|
end
|
47
47
|
|
@@ -27,8 +27,8 @@ module RailsAutoscaleAgent
|
|
27
27
|
current_queues = ::Resque.queues
|
28
28
|
|
29
29
|
# Don't collect worker metrics if there are unreasonable number of queues
|
30
|
-
if current_queues.size >
|
31
|
-
logger.
|
30
|
+
if current_queues.size > Config.instance.max_queues
|
31
|
+
logger.warn "Skipping Resque metrics - #{current_queues.size} queues exceeds the #{Config.instance.max_queues} queue limit"
|
32
32
|
return
|
33
33
|
end
|
34
34
|
|
@@ -29,8 +29,8 @@ module RailsAutoscaleAgent
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# Don't collect worker metrics if there are unreasonable number of queues
|
32
|
-
if queues_by_name.size >
|
33
|
-
logger.
|
32
|
+
if queues_by_name.size > Config.instance.max_queues
|
33
|
+
logger.warn "Skipping Sidekiq metrics - #{queues_by_name.size} queues exceeds the #{Config.instance.max_queues} queue limit"
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
@@ -9,12 +9,20 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Adam McCrea"]
|
10
10
|
spec.email = ["adam@adamlogic.com"]
|
11
11
|
|
12
|
-
spec.summary = "This gem works with the Rails Autoscale Heroku add-on to automatically scale your web dynos."
|
13
|
-
spec.homepage = "https://
|
12
|
+
spec.summary = "This gem works with the Rails Autoscale Heroku add-on to automatically scale your web and worker dynos."
|
13
|
+
spec.homepage = "https://railsautoscale.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.required_ruby_version = '>= 2.5'
|
19
|
+
spec.required_ruby_version = '>= 2.5.0'
|
20
|
+
|
21
|
+
spec.metadata = {
|
22
|
+
"homepage_uri" => "https://railsautoscale.com",
|
23
|
+
"bug_tracker_uri" => "https://github.com/adamlogic/rails_autoscale_agent/issues",
|
24
|
+
"documentation_uri" => "https://railsautoscale.com/docs",
|
25
|
+
"changelog_uri" => "https://github.com/adamlogic/rails_autoscale_agent/blob/master/CHANGELOG.md",
|
26
|
+
"source_code_uri" => "https://github.com/adamlogic/rails_autoscale_agent",
|
27
|
+
}
|
20
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_autoscale_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -19,7 +19,6 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- ".gitignore"
|
21
21
|
- ".rspec"
|
22
|
-
- ".ruby-version"
|
23
22
|
- ".travis.yml"
|
24
23
|
- ".vscode/tasks.json"
|
25
24
|
- CHANGELOG.md
|
@@ -49,10 +48,15 @@ files:
|
|
49
48
|
- lib/rails_autoscale_agent/worker_adapters/sidekiq.rb
|
50
49
|
- log/.gitkeep
|
51
50
|
- rails_autoscale_agent.gemspec
|
52
|
-
homepage: https://
|
51
|
+
homepage: https://railsautoscale.com
|
53
52
|
licenses:
|
54
53
|
- MIT
|
55
|
-
metadata:
|
54
|
+
metadata:
|
55
|
+
homepage_uri: https://railsautoscale.com
|
56
|
+
bug_tracker_uri: https://github.com/adamlogic/rails_autoscale_agent/issues
|
57
|
+
documentation_uri: https://railsautoscale.com/docs
|
58
|
+
changelog_uri: https://github.com/adamlogic/rails_autoscale_agent/blob/master/CHANGELOG.md
|
59
|
+
source_code_uri: https://github.com/adamlogic/rails_autoscale_agent
|
56
60
|
post_install_message:
|
57
61
|
rdoc_options: []
|
58
62
|
require_paths:
|
@@ -61,16 +65,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
65
|
requirements:
|
62
66
|
- - ">="
|
63
67
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
68
|
+
version: 2.5.0
|
65
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
70
|
requirements:
|
67
71
|
- - ">="
|
68
72
|
- !ruby/object:Gem::Version
|
69
73
|
version: '0'
|
70
74
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
75
|
+
rubygems_version: 3.2.15
|
72
76
|
signing_key:
|
73
77
|
specification_version: 4
|
74
78
|
summary: This gem works with the Rails Autoscale Heroku add-on to automatically scale
|
75
|
-
your web dynos.
|
79
|
+
your web and worker dynos.
|
76
80
|
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.6.5
|