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 / 10-minute HASH layout comes from Wurk::Metrics::History; the class-level Query.for_job / Query.top_jobs (Metrics::DashboardSeries) already do the fan-out. The wrapper here is a stable entry point so the controller doesn't reach into Query directly.

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 [{at: Time, p:, f:, ms:}, …] ordered oldest→newest.



252
253
254
# File 'lib/wurk/web/enterprise.rb', line 252

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 [{at:, p:, f:, ms:}, …] oldest→newest.



266
267
268
# File 'lib/wurk/web/enterprise.rb', line 266

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

.queue_history(bucket, window:, queues: nil, now: ::Time.now) ⇒ Object

Per-queue size/latency gauge time-series for the Historical tab. bucket is '1m'/'5m'/'1h'; window is in seconds (clamped to the bucket's retention). queues: narrows to one queue (else every live queue). Returns [{name:, points: [{at:, size:, latency:}, …]}, …].



274
275
276
# File 'lib/wurk/web/enterprise.rb', line 274

def queue_history(bucket, window:, queues: nil, now: ::Time.now)
  Wurk::Metrics::Query.queue_history(bucket, window, queues: queues, now: now)
end

.snapshots(limit: Wurk::History::STREAM_DEFAULT_LIMIT) ⇒ Object

Ent §5.3 Historical snapshots from the history:metrics stream, oldest→newest. Returns [{at:, processed:, failures:, …}, …].



280
281
282
# File 'lib/wurk/web/enterprise.rb', line 280

def snapshots(limit: Wurk::History::STREAM_DEFAULT_LIMIT)
  Wurk::History.recent(limit: limit)
end

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

Global top-N rollup. Wraps Query.top_jobs and keeps the wire shape of [[class_name, {p:, f:, ms:}], ...]. hours: reads the 10-minute buckets instead of the per-minute ones.



259
260
261
# File 'lib/wurk/web/enterprise.rb', line 259

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