Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/controllers/allgood/healthcheck_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def run_checks
if check[:status] == :skipped
{
name: check[:name],
description: check[:description],
success: true,
skipped: true,
message: check[:skip_reason],
Expand All @@ -56,6 +57,7 @@ def run_single_check(check)

return {
name: check[:name],
description: check[:description],
success: last_result ? last_result[:success] : true,
skipped: true,
message: message,
Expand All @@ -64,7 +66,11 @@ def run_single_check(check)
end

start_time = Time.now
result = { success: false, message: "Check timed out after #{check[:timeout]} seconds" }
result = {
description: check[:description],
success: false,
message: "Check timed out after #{check[:timeout]} seconds"
}
error_key = "allgood:error:#{check[:name].parameterize}"

begin
Expand Down Expand Up @@ -104,6 +110,7 @@ def run_single_check(check)

{
name: check[:name],
description: check[:description],
success: result[:success],
message: result[:message],
duration: ((Time.now - start_time) * 1000).round(1)
Expand Down
13 changes: 13 additions & 0 deletions app/views/allgood/healthcheck/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
.skipped {
opacity: 0.6;
}

.description {
margin-left: 0.5rem;
border-left: gray solid 2px;
padding: 0.5rem 1rem;
opacity: 0.6;
}
</style>

<header>
Expand All @@ -36,6 +43,12 @@
<% unless result[:skipped] %>
<code>[<%= result[:duration] %>ms]</code>
<% end %>

<% if result[:description].present? %>
<div class="description">
<%= sanitize result[:description] %>
</div>
<% end %>
</div>
<% end %>
<% else %>
Expand Down
1 change: 1 addition & 0 deletions lib/allgood/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def initialize
def check(name, **options, &block)
check_info = {
name: name,
description: options[:description],
block: block,
timeout: options[:timeout] || @default_timeout,
options: options,
Expand Down