Class: ChronoForge::Dashboard::PeriodicHealthPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/chrono_forge/dashboard/periodic_health_presenter.rb

Overview

Health of a workflow’s durably_repeat tasks. Never materializes the full run history (which can be huge) — coordination logs are a tiny set, and each task’s run aggregates are computed with bounded/scoped queries that ride the

workflow_id, step_name

index as range scans.

Defined Under Namespace

Classes: Task

Constant Summary collapse

RECENT =
20
SCAN_CAP =

Bound the metadata scan used to count missed ticks (see #missed_ticks).

1_000

Instance Method Summary collapse

Constructor Details

#initialize(workflow) ⇒ PeriodicHealthPresenter

Returns a new instance of PeriodicHealthPresenter.



14
# File 'app/presenters/chrono_forge/dashboard/periodic_health_presenter.rb', line 14

def initialize(workflow) = @workflow = workflow

Instance Method Details

#tasksObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/presenters/chrono_forge/dashboard/periodic_health_presenter.rb', line 16

def tasks
  coordinations.map do |coord|
    name = StepNameParser.parse(coord.step_name).name
    Task.new(
      name: name,
      last_execution_at: parse_time(coord.&.dig("last_execution_at")),
      next_scheduled_at: next_scheduled(name),
      timed_out_count: missed_ticks(name),
      latencies: recent_latencies(name)
    )
  end
end