Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial Performance panel to dashboard #1388

Merged
merged 34 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8007e16
stats
arnaudlevy May 25, 2024
91406e4
fix
arnaudlevy May 25, 2024
adcd3af
version
arnaudlevy May 25, 2024
90a3ddb
fix
arnaudlevy May 25, 2024
72cf611
charts
arnaudlevy May 25, 2024
ef4822f
chart enhancement
arnaudlevy May 25, 2024
e8a47d9
better appearance and order
arnaudlevy May 25, 2024
091b58e
less refactor
arnaudlevy May 26, 2024
895633f
Merge branch 'main' into main
arnaudlevy May 27, 2024
ced3f7a
linebreaks
arnaudlevy May 27, 2024
ea970fe
Merge branch 'main' of github.com:noesya/good_job
arnaudlevy May 27, 2024
18d7db3
10 longest
arnaudlevy May 27, 2024
1ce88fd
fix
arnaudlevy May 27, 2024
6b77430
state tabs badges use filters
SebouChu May 27, 2024
9d35a05
performance
arnaudlevy May 28, 2024
3be3342
statistics -> performance
arnaudlevy May 28, 2024
38dce88
i18n
arnaudlevy May 28, 2024
a988551
sql
arnaudlevy May 28, 2024
70e6a44
Merge branches 'main' and 'main' of github.com:noesya/good_job
arnaudlevy May 29, 2024
6be585a
Merge branch 'bensheldon:main' into main
SebouChu Jun 13, 2024
212117c
remove filter fix
SebouChu Jun 13, 2024
5b5922f
remove performances#show
SebouChu Jun 13, 2024
bc104c1
indent
SebouChu Jun 13, 2024
769be63
finished_between not used anymore
SebouChu Jun 13, 2024
a37f3fa
clean performances controller
SebouChu Jun 13, 2024
7e5c9c3
fix job_class in seeds
SebouChu Jun 14, 2024
1f54609
fix seeds (handle discrete)
SebouChu Jun 14, 2024
f7391ee
performance tab: single sql request
SebouChu Jun 14, 2024
7f61010
Merge branch 'main' into main
SebouChu Jul 5, 2024
400061b
use duration instead of extracting epoch
SebouChu Jul 5, 2024
f3f384e
Tweak html and css and add a smoketest
bensheldon Jul 5, 2024
3521527
Tweak html and css and add a smoketest
bensheldon Jul 5, 2024
e251488
Add a controller test for better visibility into errors
bensheldon Jul 6, 2024
e52cb1f
Add override for Rails 6.0 which does not support intervals
bensheldon Jul 6, 2024
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
23 changes: 23 additions & 0 deletions app/controllers/good_job/performances_controller.rb
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
1 change: 1 addition & 0 deletions app/helpers/good_job/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module ApplicationHelper

def format_duration(sec)
return unless sec
return "" if sec.is_a?(String) # pg interval support added in Rails 6.1

if sec < 1
t 'good_job.duration.milliseconds', ms: (sec * 1000).floor
Expand Down
50 changes: 50 additions & 0 deletions app/views/good_job/performances/index.html.erb
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 %>
5 changes: 5 additions & 0 deletions app/views/good_job/shared/_navbar.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
<span data-async-values-target="value" data-async-values-key="processes_count" data-async-values-zero-class="bg-danger" class="badge bg-secondary rounded-pill d-none"></span>
<% end %>
</li>
<li class="nav-item">
<%= link_to performances_path, class: ["nav-link", ("active" if controller_name == 'performances')] do %>
<%= t(".performances") %>
<% end %>
</li>
</ul>

<ul class="navbar-nav">
Expand Down
11 changes: 11 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ de:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: Durchschnittliche Dauer
executions: Hinrichtungen
job_class: Berufsklasse
maximum_duration: Maximale Dauer
minimum_duration: Mindestdauer
title: Leistung
processes:
index:
cron_enabled: Cron aktiviert
Expand Down Expand Up @@ -225,6 +233,7 @@ de:
jobs: Jobs
live_poll: Live Poll
name: "GoodJob 👍"
performances: Leistung
processes: Prozesse
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ de:
running: Laufend
scheduled: Geplant
succeeded: Erfolgreich
shared:
needs_migration: Bitte führen Sie GoodJob-Migrationen aus.
11 changes: 11 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ en:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: Average duration
executions: Executions
job_class: Job class
maximum_duration: Maximum duration
minimum_duration: Minimum duration
title: Performance
processes:
index:
cron_enabled: Cron enabled
Expand Down Expand Up @@ -225,6 +233,7 @@ en:
jobs: Jobs
live_poll: Live Poll
name: "GoodJob 👍"
performances: Performance
processes: Processes
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ en:
running: Running
scheduled: Scheduled
succeeded: Succeeded
shared:
needs_migration: Please run GoodJob migrations.
11 changes: 11 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ es:
thousand: k
trillion: T
unit: ''
performances:
index:
average_duration: Duración promedio
executions: Ejecuciones
job_class: clase de trabajo
maximum_duration: Duración máxima
minimum_duration: Duración mínima
title: Actuación
processes:
index:
cron_enabled: Cron habilitado
Expand Down Expand Up @@ -225,6 +233,7 @@ es:
jobs: Tareas
live_poll: En vivo
name: "GoodJob 👍"
performances: Actuación
processes: Procesos
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ es:
running: Ejecutando
scheduled: Programado
succeeded: Exitoso
shared:
needs_migration: Ejecute las migraciones de GoodJob.
11 changes: 11 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ fr:
thousand: k
trillion: J
unit: ''
performances:
index:
average_duration: Durée moyenne
executions: Exécutions
job_class: Catégorie d'emplois
maximum_duration: Durée maximale
minimum_duration: Durée minimale
title: Performance
processes:
index:
cron_enabled: Cron activé
Expand Down Expand Up @@ -225,6 +233,7 @@ fr:
jobs: Jobs
live_poll: En direct
name: "GoodJob 👍"
performances: Performance
processes: Processus
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ fr:
running: En cours
scheduled: Planifiés
succeeded: Réussis
shared:
needs_migration: Veuillez exécuter des migrations GoodJob.
11 changes: 11 additions & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ it:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: Durata media
executions: Esecuzioni
job_class: Classe di lavoro
maximum_duration: Durata massima
minimum_duration: Durata minima
title: Prestazione
processes:
index:
cron_enabled: Cron abilitato
Expand Down Expand Up @@ -225,6 +233,7 @@ it:
jobs: Job
live_poll: Live Poll
name: "GoodJob 👍"
performances: Prestazione
processes: Processi
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ it:
running: In esecuzione
scheduled: Pianificato
succeeded: Riuscito
shared:
needs_migration: Esegui le migrazioni GoodJob.
11 changes: 11 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ ja:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: 平均所要時間
executions: 処刑
job_class: 職種
maximum_duration: 最大持続時間
minimum_duration: 最小期間
title: パフォーマンス
processes:
index:
cron_enabled: Cron が有効になっている
Expand Down Expand Up @@ -225,6 +233,7 @@ ja:
jobs: ジョブ
live_poll: リアルタイム更新
name: "GoodJob 👍"
performances: パフォーマンス
processes: プロセス
theme:
auto: 自動
Expand All @@ -241,3 +250,5 @@ ja:
running: 実行中
scheduled: スケジュール待ち
succeeded: 成功済み
shared:
needs_migration: GoodJob 移行を実行してください。
11 changes: 11 additions & 0 deletions config/locales/ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ ko:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: 평균 지속 시간
executions: 처형
job_class: 직업군
maximum_duration: 최대 기간
minimum_duration: 최소 기간
title: 성능
processes:
index:
cron_enabled: Cron이 활성화되어 있음
Expand Down Expand Up @@ -225,6 +233,7 @@ ko:
jobs: 작업
live_poll: 실시간 업데이트
name: "GoodJob 👍"
performances: 성능
processes: 프로세스
theme:
auto: 자동
Expand All @@ -241,3 +250,5 @@ ko:
running: 실행 중
scheduled: 예정됨
succeeded: 성공함
shared:
needs_migration: GoodJob 마이그레이션을 실행하세요.
11 changes: 11 additions & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ nl:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: Gemiddelde duur
executions: Executies
job_class: Functie klasse
maximum_duration: Maximale duur
minimum_duration: Minimale duur
title: Prestatie
processes:
index:
cron_enabled: Cron ingeschakeld
Expand Down Expand Up @@ -225,6 +233,7 @@ nl:
jobs: Taken
live_poll: Live Poll
name: "GoodJob 👍"
performances: Prestatie
processes: Processen
theme:
auto: Auto
Expand All @@ -241,3 +250,5 @@ nl:
running: Rennen
scheduled: Gepland
succeeded: Geslaagd
shared:
needs_migration: Voer GoodJob-migraties uit.
11 changes: 11 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ pt-BR:
thousand: K
trillion: T
unit: ''
performances:
index:
average_duration: Duração média
executions: Execuções
job_class: Classe de trabalho
maximum_duration: Duração máxima
minimum_duration: Duração mínima
title: Desempenho
processes:
index:
cron_enabled: Agendamento ativado
Expand Down Expand Up @@ -225,6 +233,7 @@ pt-BR:
jobs: Tarefas
live_poll: Acompanhamento ao Vivo
name: "GoodJob 👍"
performances: Desempenho
processes: Processos
theme:
auto: Automático
Expand All @@ -241,3 +250,5 @@ pt-BR:
running: Em execução
scheduled: Agendado
succeeded: Concluído com sucesso
shared:
needs_migration: Execute migrações GoodJob.
11 changes: 11 additions & 0 deletions config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ ru:
thousand: К
trillion: Т
unit: ''
performances:
index:
average_duration: Средняя продолжительность
executions: Казни
job_class: Класс работы
maximum_duration: Максимальная продолжительность
minimum_duration: Минимальная продолжительность
title: Производительность
processes:
index:
cron_enabled: Cron включен
Expand Down Expand Up @@ -251,6 +259,7 @@ ru:
jobs: Задания
live_poll: Обновления в реальном времени
name: "GoodJob 👍"
performances: Производительность
processes: Процессы
theme:
auto: Авто
Expand All @@ -267,3 +276,5 @@ ru:
running: Исполняется
scheduled: Запланировано
succeeded: Успешно
shared:
needs_migration: Пожалуйста, запустите миграцию GoodJob.
Loading
Loading