Module: Woods::Console::Tools::Tier3

Defined in:
lib/woods/console/tools/tier3.rb

Overview

Tier 3: Analytics tools for monitoring live Rails application state.

Provides request performance metrics, job queue monitoring, cache statistics, and ActionCable channel status. Job-related tools delegate to backend-specific adapters (Sidekiq, Solid Queue, GoodJob).

Each method builds a bridge request hash from validated parameters. The bridge executes the query against the Rails environment.

Class Method Summary collapse

Class Method Details

.console_cache_stats(namespace: nil) ⇒ Hash

Get cache store statistics.

Parameters:

  • namespace (String, nil) (defaults to: nil)

    Cache namespace filter

Returns:

  • (Hash)

    Bridge request



96
97
98
# File 'lib/woods/console/tools/tier3.rb', line 96

def console_cache_stats(namespace: nil)
  { tool: 'cache_stats', params: { namespace: namespace }.compact }
end

.console_channel_status(channel: nil) ⇒ Hash

Get ActionCable channel status.

Parameters:

  • channel (String, nil) (defaults to: nil)

    Filter by channel name

Returns:

  • (Hash)

    Bridge request



104
105
106
# File 'lib/woods/console/tools/tier3.rb', line 104

def console_channel_status(channel: nil)
  { tool: 'channel_status', params: { channel: channel }.compact }
end

.console_error_rates(period: '1h', controller: nil) ⇒ Hash

Get error rates by controller or overall.

Parameters:

  • period (String) (defaults to: '1h')

    Time period (default: “1h”)

  • controller (String, nil) (defaults to: nil)

    Filter by controller name

Returns:

  • (Hash)

    Bridge request



33
34
35
# File 'lib/woods/console/tools/tier3.rb', line 33

def console_error_rates(period: '1h', controller: nil)
  { tool: 'error_rates', params: { period: period, controller: controller }.compact }
end

.console_job_failures(limit: 10, queue: nil) ⇒ Hash

List recent job failures.

Parameters:

  • limit (Integer) (defaults to: 10)

    Max failures to return (default: 10, max: 100)

  • queue (String, nil) (defaults to: nil)

    Filter by queue name

Returns:

  • (Hash)

    Bridge request



59
60
61
62
# File 'lib/woods/console/tools/tier3.rb', line 59

def console_job_failures(limit: 10, queue: nil)
  limit = [limit, 100].min
  { tool: 'job_failures', params: { limit: limit, queue: queue }.compact }
end

.console_job_find(job_id:, retry_job: nil) ⇒ Hash

Find a job by ID, optionally retry it (requires confirmation).

Parameters:

  • job_id (String)

    Job identifier

  • retry_job (Boolean, nil) (defaults to: nil)

    Whether to retry the job

Returns:

  • (Hash)

    Bridge request, with requires_confirmation if retry requested



69
70
71
72
73
# File 'lib/woods/console/tools/tier3.rb', line 69

def console_job_find(job_id:, retry_job: nil)
  result = { tool: 'job_find', params: { job_id: job_id, retry: retry_job }.compact }
  result[:requires_confirmation] = true if retry_job
  result
end

.console_job_queues(queue: nil) ⇒ Hash

Get job queue statistics.

Parameters:

  • queue (String, nil) (defaults to: nil)

    Filter by queue name

Returns:

  • (Hash)

    Bridge request



50
51
52
# File 'lib/woods/console/tools/tier3.rb', line 50

def console_job_queues(queue: nil)
  { tool: 'job_queues', params: { queue: queue }.compact }
end

.console_job_schedule(limit: 20) ⇒ Hash

List scheduled/upcoming jobs.

Parameters:

  • limit (Integer) (defaults to: 20)

    Max jobs to return (default: 20, max: 100)

Returns:

  • (Hash)

    Bridge request



79
80
81
82
# File 'lib/woods/console/tools/tier3.rb', line 79

def console_job_schedule(limit: 20)
  limit = [limit, 100].min
  { tool: 'job_schedule', params: { limit: limit } }
end

.console_redis_info(section: nil) ⇒ Hash

Get Redis server information.

Parameters:

  • section (String, nil) (defaults to: nil)

    Redis INFO section filter (e.g., “memory”, “stats”)

Returns:

  • (Hash)

    Bridge request



88
89
90
# File 'lib/woods/console/tools/tier3.rb', line 88

def console_redis_info(section: nil)
  { tool: 'redis_info', params: { section: section }.compact }
end

.console_slow_endpoints(limit: 10, period: '1h') ⇒ Hash

List slowest endpoints by response time.

Parameters:

  • limit (Integer) (defaults to: 10)

    Max endpoints to return (default: 10, max: 100)

  • period (String) (defaults to: '1h')

    Time period (default: “1h”)

Returns:

  • (Hash)

    Bridge request



23
24
25
26
# File 'lib/woods/console/tools/tier3.rb', line 23

def console_slow_endpoints(limit: 10, period: '1h')
  limit = [limit, 100].min
  { tool: 'slow_endpoints', params: { limit: limit, period: period } }
end

.console_throughput(period: '1h', interval: '5m') ⇒ Hash

Get request throughput over time.

Parameters:

  • period (String) (defaults to: '1h')

    Time period (default: “1h”)

  • interval (String) (defaults to: '5m')

    Aggregation interval (default: “5m”)

Returns:

  • (Hash)

    Bridge request



42
43
44
# File 'lib/woods/console/tools/tier3.rb', line 42

def console_throughput(period: '1h', interval: '5m')
  { tool: 'throughput', params: { period: period, interval: interval } }
end