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
-
.for_job(klass, minutes: nil, hours: nil, now: ::Time.now) ⇒ Object
Per-class time series.
-
.history(bucket, window:, now: ::Time.now) ⇒ Object
Cluster-total time-series for the dashboard charts.
-
.queue_history(bucket, window:, queues: nil, now: ::Time.now) ⇒ Object
Per-queue size/latency gauge time-series for the Historical tab.
-
.snapshots(limit: Wurk::History::STREAM_DEFAULT_LIMIT) ⇒ Object
Ent §5.3 Historical snapshots from the
history:metricsstream, oldest→newest. -
.top(minutes: 60, class_filter: nil) ⇒ Object
Global top-N rollup.
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.
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 [{at:, 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 |
.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:}, …]}, …].
140 141 142 |
# File 'lib/wurk/web/enterprise.rb', line 140 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:, …}, …].
146 147 148 |
# File 'lib/wurk/web/enterprise.rb', line 146 def snapshots(limit: Wurk::History::STREAM_DEFAULT_LIMIT) Wurk::History.recent(limit: limit) end |
.top(minutes: 60, class_filter: nil) ⇒ Object
Global top-N rollup. Wraps Query.top_jobs and keeps the wire
shape of [[class_name, {p:, 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 |