Module: RoundhouseUi

Defined in:
lib/roundhouse_ui.rb,
lib/roundhouse_ui/tags.rb,
lib/roundhouse_ui/audit.rb,
lib/roundhouse_ui/fetch.rb,
lib/roundhouse_ui/pause.rb,
lib/roundhouse_ui/engine.rb,
lib/roundhouse_ui/health.rb,
lib/roundhouse_ui/metrics.rb,
lib/roundhouse_ui/version.rb,
lib/roundhouse_ui/redaction.rb,
lib/roundhouse_ui/snapshots.rb,
lib/roundhouse_ui/cancellation.rb,
lib/roundhouse_ui/error_groups.rb,
lib/roundhouse_ui/observability.rb,
lib/roundhouse_ui/backends/sidekiq.rb,
lib/roundhouse_ui/cancel_middleware.rb,
app/helpers/roundhouse_ui/nav_helper.rb,
lib/roundhouse_ui/duration_collector.rb,
app/helpers/roundhouse_ui/tags_helper.rb,
lib/roundhouse_ui/backends/solid_queue.rb,
app/helpers/roundhouse_ui/application_helper.rb,
app/controllers/roundhouse_ui/busy_controller.rb,
app/controllers/roundhouse_ui/dead_controller.rb,
app/controllers/roundhouse_ui/jobs_controller.rb,
app/controllers/roundhouse_ui/audit_controller.rb,
app/controllers/roundhouse_ui/redis_controller.rb,
app/helpers/roundhouse_ui/observability_helper.rb,
app/controllers/roundhouse_ui/assets_controller.rb,
app/controllers/roundhouse_ui/errors_controller.rb,
app/controllers/roundhouse_ui/queues_controller.rb,
app/controllers/roundhouse_ui/metrics_controller.rb,
app/controllers/roundhouse_ui/retries_controller.rb,
app/controllers/roundhouse_ui/workers_controller.rb,
app/controllers/roundhouse_ui/capsules_controller.rb,
app/controllers/roundhouse_ui/dashboard_controller.rb,
app/controllers/roundhouse_ui/scheduled_controller.rb,
app/controllers/roundhouse_ui/snapshots_controller.rb,
app/controllers/roundhouse_ui/application_controller.rb,
app/controllers/concerns/roundhouse_ui/job_set_browsing.rb

Overview

Brand name is "Roundhouse"; the gem and Ruby namespace are RoundhouseUi (matching the published gem name roundhouse_ui).

Defined Under Namespace

Modules: ApplicationHelper, Audit, Backends, Cancellation, JobSetBrowsing, NavHelper, Observability, ObservabilityHelper, Pause, Redaction, Snapshots, Tags, TagsHelper Classes: ApplicationController, AssetsController, AuditController, BusyController, CancelMiddleware, CapsulesController, DashboardController, DeadController, DurationCollector, Engine, ErrorGroups, ErrorsController, Fetch, Health, JobsController, Metrics, MetricsController, QueuesController, RedisController, RetriesController, ScheduledController, SnapshotsController, WorkersController

Constant Summary collapse

VERSION =
"0.10.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.actor_resolverObject

How the audit log names the person taking an action. Auth is the host's job, so give Roundhouse a callable that pulls the actor from the request:

RoundhouseUi.actor_resolver = ->(controller) { controller.current_user&.email }

Defaults to "anonymous".



50
51
52
# File 'lib/roundhouse_ui.rb', line 50

def actor_resolver
  @actor_resolver
end

.allow_job_editingObject

Opt-in: enqueue brand-new jobs and edit/re-enqueue existing ones from the UI. Off by default — it's a sharp tool (bad edits create unrunnable jobs).



54
55
56
# File 'lib/roundhouse_ui.rb', line 54

def allow_job_editing
  @allow_job_editing
end

.backendObject



131
132
133
# File 'lib/roundhouse_ui.rb', line 131

def backend
  @backend ||= Backends::Sidekiq.new
end

.collect_durationsObject

Opt-in: record per-class job durations (via RoundhouseUi::DurationCollector server middleware) so the Metrics page can show the slowest job classes. Default false; reads/writes a single Redis hash. The flag gates the UI; the collection itself is enabled by installing the middleware.



103
104
105
# File 'lib/roundhouse_ui.rb', line 103

def collect_durations
  @collect_durations
end

.job_tagsObject

Host-defined job tags, resolved at read time (see ADR 0002): a callable given the job's class name and payload, returning a Hash of tags or nil. klass is always the real job class (the ActiveJob adapter wrapper is unwrapped first). For the class-constant convention there's a shorthand:

RoundhouseUi.job_tags = RoundhouseUi::Tags.from_constant(:OWNER, as: :squad)
# equivalent to:
RoundhouseUi.job_tags = ->(klass:, item:) {
k = klass.safe_constantize
{ squad: k.const_get(:OWNER) } if k&.const_defined?(:OWNER)
}

Tag values render in the UI and pass through redact_args masking (by tag key). Must be cheap: by default it's memoized per class per request and called with item: nil. Default: nil (no tags anywhere).



75
76
77
# File 'lib/roundhouse_ui.rb', line 75

def job_tags
  @job_tags
end

.job_tags_per_jobObject

Set true when job_tags derives tags from the payload (args, tenant, …): the resolver is then called once per job with the full item, and nothing is cached — a 1,000-entry scan means 1,000 calls, so keep it fast. Leave false for class-derived tags (OWNER-style constants). Default: false.



81
82
83
# File 'lib/roundhouse_ui.rb', line 81

def job_tags_per_job
  @job_tags_per_job
end

.observabilityObject



40
41
42
# File 'lib/roundhouse_ui.rb', line 40

def observability
  @observability ||= Observability::NullAdapter.new
end

.pause_enabledObject

Queue pause/resume is only enforced when RoundhouseUi::Fetch is installed as the server's fetch strategy. If you run reliable fetch (Sidekiq Pro/Enterprise super_fetch) you can't also run our fetcher, so pause can't be enforced — set this to false to hide the pause controls and the "not enforced" warning entirely. Default: true.



115
116
117
# File 'lib/roundhouse_ui.rb', line 115

def pause_enabled
  @pause_enabled
end

.poll_intervalObject

Seconds between dashboard stat polls. Lower = livelier, but each poll also re-runs the host's auth/routing on the mount, so a busy console can add DB load. Default 5s; raise it if polling shows up in your traces.



108
109
110
# File 'lib/roundhouse_ui.rb', line 108

def poll_interval
  @poll_interval
end

.read_onlyObject

When true, destructive actions (purge, retry, delete, …) are disabled. Mount Roundhouse read-only where operators should only observe.



26
27
28
# File 'lib/roundhouse_ui.rb', line 26

def read_only
  @read_only
end

.redact_argsObject

Argument keys (substring, case-insensitive) to mask when displaying jobs. e.g. RoundhouseUi.redact_args = %w[password token secret]. Default: none.



58
59
60
# File 'lib/roundhouse_ui.rb', line 58

def redact_args
  @redact_args
end

.show_sidekiq_failuresObject

Opt-in: fold failures recorded by the sidekiq-failures gem (its failed sorted set) into the grouped Errors view. Off by default, and a no-op unless sidekiq-failures is loaded. Jobs with retry: false never enter Sidekiq's retry/dead sets, so this is the only way to surface them here.



97
98
99
# File 'lib/roundhouse_ui.rb', line 97

def show_sidekiq_failures
  @show_sidekiq_failures
end

.snapshot_storeObject



32
33
34
# File 'lib/roundhouse_ui.rb', line 32

def snapshot_store
  @snapshot_store ||= Snapshots::RedisStore.new
end

.tag_filtersObject

Optional declared filter vocabulary, so tag filter dropdowns are stable instead of discovered from whatever jobs happen to be visible:

RoundhouseUi.tag_filters = { squad: %w[core training growth platform ops ai] }

Values (or the whole setting) may be callables for dynamic vocabularies. When set, filtering by an undeclared key matches nothing (fail-closed). Default: nil — the filter UI discovers values from the entries it scans.



91
92
93
# File 'lib/roundhouse_ui.rb', line 91

def tag_filters
  @tag_filters
end

Class Method Details

.cancelled?(jid) ⇒ Boolean

Cooperative cancellation check for long-running jobs:

raise SomeStop if RoundhouseUi.cancelled?(jid)

Returns:

  • (Boolean)


137
138
139
# File 'lib/roundhouse_ui.rb', line 137

def cancelled?(jid)
  Cancellation.cancelled?(jid)
end

.configure {|_self| ... } ⇒ Object

Configure in an initializer:

RoundhouseUi.configure do |c|
c.read_only = !Rails.env.development?
end

Yields:

  • (_self)

Yield Parameters:

  • _self (RoundhouseUi)

    the object that the method was called on



122
123
124
# File 'lib/roundhouse_ui.rb', line 122

def configure
  yield self
end