-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial Performance panel to dashboard (#1388)
--------- Co-authored-by: Arnaud Levy <[email protected]> Co-authored-by: Arnaud Levy <[email protected]> Co-authored-by: Sébastien Gaya <[email protected]>
- Loading branch information
1 parent
d8b6344
commit 94b672c
Showing
20 changed files
with
258 additions
and
1 deletion.
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,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module GoodJob | ||
class PerformancesController < ApplicationController | ||
def index | ||
if GoodJob::DiscreteExecution.monotonic_duration_migrated? | ||
@performances = GoodJob::DiscreteExecution | ||
.where.not(job_class: nil) | ||
.group(:job_class) | ||
.select(" | ||
job_class, | ||
COUNT(*) AS executions_count, | ||
AVG(duration) AS avg_duration, | ||
MIN(duration) AS min_duration, | ||
MAX(duration) AS max_duration | ||
") | ||
.order("job_class") | ||
else | ||
@needs_upgrade = true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<div class="border-bottom"> | ||
<h2 class="pt-3 pb-2"><%= t ".title" %></h2> | ||
</div> | ||
|
||
<% if @needs_upgrade %> | ||
<div class="alert alert-warning"> | ||
<%= t "shared.needs_migration" %> | ||
</div> | ||
<% else %> | ||
|
||
<div class="my-3 card"> | ||
<div class="list-group list-group-flush text-nowrap" role="table"> | ||
<header class="list-group-item bg-body-tertiary"> | ||
<div class="row small text-muted text-uppercase align-items-center"> | ||
<div class="col-12 col-lg-4"><%= t ".job_class" %></div> | ||
<div class="col-lg-1 d-none d-lg-block"><%= t ".executions" %></div> | ||
|
||
<div class="col-lg-1 d-none d-lg-block"><%= t ".average_duration" %></div> | ||
<div class="col-lg-1 d-none d-lg-block"><%= t ".minimum_duration" %></div> | ||
<div class="col-lg-1 d-none d-lg-block"><%= t ".maximum_duration" %></div> | ||
</div> | ||
</header> | ||
|
||
<% @performances.each do |performance| %> | ||
<div role="row" class="list-group-item py-3"> | ||
<div class="row align-items-center"> | ||
<div class="col-12 col-lg-4"><%= performance.job_class %></div> | ||
<div class="col-6 col-lg-1 text-wrap"> | ||
<div class="d-lg-none small text-muted mt-1"><%= t ".executions" %></div> | ||
<%= performance.executions_count %> | ||
</div> | ||
|
||
<div class="col-6 col-lg-1 text-wrap"> | ||
<div class="d-lg-none small text-muted mt-1"><%= t ".average_duration" %></div> | ||
<%= format_duration performance.avg_duration %> | ||
</div> | ||
<div class="col-6 col-lg-1 text-wrap"> | ||
<div class="d-lg-none small text-muted mt-1"><%= t ".minimum_duration" %></div> | ||
<%= format_duration performance.min_duration %> | ||
</div> | ||
<div class="col-6 col-lg-1 text-wrap"> | ||
<div class="d-lg-none small text-muted mt-1"><%= t ".maximum_duration" %></div> | ||
<%= format_duration performance.max_duration %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% 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 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 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
Oops, something went wrong.