Module: Wurk::Web::Enterprise::Historical

Defined in:
lib/wurk/web/enterprise.rb

Overview

Historical tab — per-class and per-queue gauges over a recent window. The minute / hour HASH layout comes from ‘Wurk::Metrics::History`; `Query.for_job` / `Query.top_jobs` already does the fan-out. The wrapper here is a stable entry point so the controller doesn’t reach into the ‘Query` module directly (and so we have one place to layer additional aggregations on later — global gauges across all classes).

Class Method Summary collapse

Class Method Details

.for_job(klass, minutes: nil, hours: nil, now: ::Time.now) ⇒ Object

Per-class time series. Pass exactly one of ‘minutes:` / `hours:`. Returns `[Time, p:, f:, ms:, …]` ordered oldest→newest.



119
120
121
# File 'lib/wurk/web/enterprise.rb', line 119

def for_job(klass, minutes: nil, hours: nil, now: ::Time.now)
  Wurk::Metrics::Query.for_job(klass, minutes: minutes, hours: hours, now: now)
end

.history(bucket, window:, now: ::Time.now) ⇒ Object

Cluster-total time-series for the dashboard charts. ‘bucket` is ’1m’/‘5m’/‘1h’; ‘window` is in seconds (clamped to the bucket’s retention). Returns ‘[p:, f:, ms:, …]` oldest→newest.



132
133
134
# File 'lib/wurk/web/enterprise.rb', line 132

def history(bucket, window:, now: ::Time.now)
  Wurk::Metrics::Query.history(bucket, window, now: now)
end

.top(minutes: 60, class_filter: nil) ⇒ Object

Global top-N rollup. Wraps ‘Query.top_jobs` and keeps the wire shape of `[[class_name, f:, ms:], …]`.



125
126
127
# File 'lib/wurk/web/enterprise.rb', line 125

def top(minutes: 60, class_filter: nil)
  Wurk::Metrics::Query.top_jobs(minutes: minutes, class_filter: class_filter)
end