This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from stitchfix/redesign-monitoring-internals
Redesign monitoring internals
- Loading branch information
Showing
18 changed files
with
135 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Monitoring | ||
class CheckResult | ||
attr_reader :resque_name, # Name of the resque the check checked | ||
:scope, # Refined scope inside this resque, if relavent (e.g. queue name or class name) | ||
:check_name, # Name of the thing checked | ||
:check_count # Count related to what was being checked | ||
|
||
def initialize(resque_name: nil,check_name: nil,check_count: nil, scope: nil) | ||
@resque_name = required! resque_name, "resque_name" | ||
@check_name = required! check_name, "check_name" | ||
@check_count = required! check_count, "check_count", :to_i | ||
@scope = optional scope | ||
end | ||
|
||
private | ||
|
||
def required!(value, name, conversion = :to_s) | ||
raise ArgumentError, "#{name} is required" if value.nil? | ||
value.send(conversion) | ||
end | ||
|
||
def optional(value) | ||
if value.nil? | ||
nil | ||
else | ||
value.to_s | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
module Monitoring | ||
class StaleWorkerCheck < Monitoring::Checker | ||
def check! | ||
Hash[@resques.all.map { |resque_instance| | ||
[resque_instance.name,resque_instance.jobs_running.select(&:too_long?)] | ||
}] | ||
@resques.all.map { |resque_instance| | ||
CheckResult.new(resque_name: resque_instance.name, | ||
check_name: "resque.stale_workers", | ||
check_count: resque_instance.jobs_running.select(&:too_long?).size) | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.