roqua-support 0.3.0 → 0.3.1
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 +4 -4
- data/.rspec +0 -0
- data/.travis.yml +0 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -1
- data/LICENSE.txt +0 -0
- data/circle.yml +0 -0
- data/lib/roqua-support/version.rb +1 -1
- data/lib/roqua/core_ext/active_interaction/filters/date_time_as_unix_extension.rb +0 -0
- data/lib/roqua/core_ext/active_interaction/filters/duration_filter.rb +0 -0
- data/lib/roqua/core_ext/active_interaction/rails_instrumentation.rb +0 -0
- data/lib/roqua/core_ext/activerecord/uniq_find_or_create.rb +0 -0
- data/lib/roqua/core_ext/enumerable/sort_by_alphanum.rb +0 -0
- data/lib/roqua/core_ext/fabrication/singleton.rb +0 -0
- data/lib/roqua/probes/base_probe.rb +16 -4
- data/lib/roqua/probes/delayed_job_probe.rb +2 -2
- data/lib/roqua/probes/monitoring_probe.rb +2 -2
- data/lib/roqua/probes/scheduling_probe.rb +2 -2
- data/lib/roqua/responders/active_interaction_aware_responder.rb +0 -0
- data/lib/roqua/responders/api_errors_responder.rb +0 -0
- data/lib/roqua/scheduling/scheduler.rb +1 -0
- data/lib/roqua/support/command_runner.rb +0 -0
- data/lib/roqua/support/instrumentation.rb +0 -0
- data/lib/roqua/support/log_wrapper.rb +0 -0
- data/lib/roqua/support/request_logger.rb +0 -0
- data/lib/roqua/support/stats.rb +0 -0
- data/lib/roqua/support/stats/hosted_graphite_backend.rb +0 -0
- data/lib/roqua/validators/subset_validator.rb +0 -0
- data/spec/roqua/core_ext/active_interaction/date_time_as_unix_extension_spec.rb +0 -0
- data/spec/roqua/core_ext/active_interaction/duration_filter_spec.rb +0 -0
- data/spec/roqua/core_ext/active_interaction/rails_intrumentation_spec.rb +0 -0
- data/spec/roqua/probes/delayed_job_probe_spec.rb +7 -2
- data/spec/roqua/probes/monitoring_probe_spec.rb +8 -3
- data/spec/roqua/responders/active_interaction_aware_responder_spec.rb +0 -0
- data/spec/roqua/responders/api_errors_responder_spec.rb +0 -0
- data/spec/roqua/scheduling/scheduler_spec.rb +8 -1
- data/spec/roqua/support/stats_spec.rb +0 -0
- data/spec/roqua/validators/subset_validator_spec.rb +0 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5997425ea5b975ef1adf4b17e10d3d6c44bbdaa6507f696db1a5aad1ddf9513
|
4
|
+
data.tar.gz: cc565728bb3fc02e707b92d8ab507c996a793f9c6d5d16b0e6d8cfed1462ae70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9fc30367ece67f45800e8ab586f86f8aed50f8033be899265c5a03a87318ebdb960b87652c69dbb03da28c419242dffa1aa6977e82708b6e33a3b9ff445c352
|
7
|
+
data.tar.gz: 28c2f803f644b2244908cc52b5326074298e81b31c8e0f3f9cd6ac9a422dab00e51ac3d1e4383f2b09516fdc045bafe6b52cde2e3cf22353608d284ce9e046d9
|
data/.rspec
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
File without changes
|
data/circle.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,12 +1,24 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
1
3
|
module Roqua
|
2
4
|
module Probes
|
3
5
|
module BaseProbe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
class_methods do
|
9
|
+
def enable
|
10
|
+
new.tap do |probe|
|
11
|
+
probe_sym = probe.class.to_s.to_sym
|
12
|
+
Appsignal::Minutely.probes.register(probe_sym, probe) unless Appsignal::Minutely.probes[probe_sym]
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
16
|
+
|
17
|
+
# do not override me, implement probes by implementing the #run method
|
18
|
+
def call
|
19
|
+
run
|
20
|
+
Appsignal.increment_counter("probe.call.completed.#{self.class.name.demodulize.underscore}", 1)
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
@@ -3,13 +3,13 @@ require_relative 'base_probe'
|
|
3
3
|
module Roqua
|
4
4
|
module Probes
|
5
5
|
class DelayedJobProbe
|
6
|
-
|
6
|
+
include BaseProbe
|
7
7
|
|
8
8
|
def backlog_count
|
9
9
|
Delayed::Job.where(locked_at: nil).where('run_at < ?', Time.zone.now).count
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def run
|
13
13
|
Appsignal.set_gauge('delayed_job_backlog_count', backlog_count)
|
14
14
|
end
|
15
15
|
end
|
@@ -3,7 +3,7 @@ require_relative 'base_probe'
|
|
3
3
|
module Roqua
|
4
4
|
module Probes
|
5
5
|
class MonitoringProbe
|
6
|
-
|
6
|
+
include BaseProbe
|
7
7
|
|
8
8
|
def incomplete_jobs
|
9
9
|
Roqua::Scheduling::CronJob.where('completed_at IS NULL OR completed_at < next_run_at')
|
@@ -19,7 +19,7 @@ module Roqua
|
|
19
19
|
(longest_delay_in_seconds / 1.minute).to_i
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def run
|
23
23
|
Appsignal.set_gauge('scheduler_delay_in_minutes', longest_delay_in_minutes)
|
24
24
|
end
|
25
25
|
end
|
@@ -3,9 +3,9 @@ require_relative 'base_probe'
|
|
3
3
|
module Roqua
|
4
4
|
module Probes
|
5
5
|
class SchedulingProbe
|
6
|
-
|
6
|
+
include BaseProbe
|
7
7
|
|
8
|
-
def
|
8
|
+
def run
|
9
9
|
ActiveRecord::Base.establish_connection
|
10
10
|
require_relative Rails.root.join('config', 'schedule.rb')
|
11
11
|
Roqua::Scheduling::Scheduler.new.ping
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/roqua/support/stats.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@ require 'roqua/probes/delayed_job_probe'
|
|
7
7
|
describe Roqua::Probes::DelayedJobProbe do
|
8
8
|
before { Timecop.freeze }
|
9
9
|
after { Timecop.return }
|
10
|
-
subject(:probe) {
|
10
|
+
subject(:probe) { described_class.new }
|
11
11
|
|
12
12
|
describe 'backlog_count' do
|
13
13
|
context 'if a single job unlocked job exists that has a run_at in the past' do
|
@@ -24,12 +24,17 @@ describe Roqua::Probes::DelayedJobProbe do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe 'call' do
|
27
|
+
describe '#call' do
|
28
28
|
it 'sends the correct metric to Appsignal' do
|
29
29
|
expect(probe).to receive(:backlog_count).and_return(12)
|
30
30
|
expect(Appsignal).to receive(:set_gauge).with('delayed_job_backlog_count', 12)
|
31
31
|
probe.call
|
32
32
|
end
|
33
|
+
|
34
|
+
it 'increments the probe call counter' do
|
35
|
+
expect(Appsignal).to receive(:increment_counter).with('probe.call.completed.delayed_job_probe', 1)
|
36
|
+
probe.call
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
40
|
context '.enable' do
|
@@ -4,21 +4,26 @@ require 'timecop'
|
|
4
4
|
|
5
5
|
require 'roqua/probes/delayed_job_probe'
|
6
6
|
|
7
|
-
describe Roqua::Probes::
|
7
|
+
describe Roqua::Probes::MonitoringProbe do
|
8
8
|
before { Timecop.freeze }
|
9
9
|
after { Timecop.return }
|
10
|
-
subject(:probe) {
|
10
|
+
subject(:probe) { described_class.new }
|
11
11
|
|
12
12
|
before do
|
13
13
|
Roqua::Scheduling::CronJob.delete_all
|
14
14
|
end
|
15
15
|
|
16
|
-
describe 'call' do
|
16
|
+
describe '#call' do
|
17
17
|
it 'sends data to AppSignal' do
|
18
18
|
expect(Appsignal).to receive(:set_gauge).with('scheduler_delay_in_minutes', 10)
|
19
19
|
expect(probe).to receive(:longest_delay_in_minutes).and_return(10)
|
20
20
|
probe.call
|
21
21
|
end
|
22
|
+
|
23
|
+
it 'increments the probe call counter' do
|
24
|
+
expect(Appsignal).to receive(:increment_counter).with('probe.call.completed.monitoring_probe', 1)
|
25
|
+
probe.call
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
describe 'longest_delay' do
|
File without changes
|
File without changes
|
@@ -72,16 +72,23 @@ describe Roqua::Scheduling::Scheduler do
|
|
72
72
|
describe 'callbacks' do
|
73
73
|
let(:callback_spy) { spy(:callback) }
|
74
74
|
|
75
|
-
|
75
|
+
before do
|
76
76
|
Roqua::Scheduling::Schedule.setup do |cron|
|
77
77
|
cron.add_task 'hourly', next_run_at: proc { 1.minute.ago } do
|
78
78
|
callback_spy.execute
|
79
79
|
end
|
80
80
|
end
|
81
|
+
end
|
81
82
|
|
83
|
+
it 'get executed' do
|
82
84
|
expect(callback_spy).to receive(:execute)
|
83
85
|
subject.ping
|
84
86
|
end
|
87
|
+
|
88
|
+
it 'counts task calls' do
|
89
|
+
expect(Appsignal).to receive(:increment_counter).with('scheduler.run_task.completed.hourly', 1)
|
90
|
+
subject.ping
|
91
|
+
end
|
85
92
|
end
|
86
93
|
|
87
94
|
describe 'when running multiple times' do
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_interaction
|
@@ -281,8 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: '0'
|
283
283
|
requirements: []
|
284
|
-
|
285
|
-
rubygems_version: 2.7.9
|
284
|
+
rubygems_version: 3.0.3
|
286
285
|
signing_key:
|
287
286
|
specification_version: 4
|
288
287
|
summary: Helper objects and proxies used by a lot of RoQua applications
|