Skip to content

Commit 9b6eae0

Browse files
authored
Merge branch 'main' into importmap-changes
2 parents ab83de9 + 9923a74 commit 9b6eae0

File tree

18 files changed

+147
-31
lines changed

18 files changed

+147
-31
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/test/dummy/storage/
1010
/test/dummy/tmp/
1111
.DS_Store
12+
.ruby-gemset

Gemfile.lock

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ GIT
2828
PATH
2929
remote: .
3030
specs:
31-
mission_control-jobs (0.3.1)
31+
mission_control-jobs (0.3.3)
3232
importmap-rails
3333
irb (~> 1.13)
34-
propshaft
3534
rails (>= 7.1)
3635
stimulus-rails
3736
turbo-rails
@@ -191,11 +190,6 @@ GEM
191190
parser (3.3.0.5)
192191
ast (~> 2.4.1)
193192
racc
194-
propshaft (0.8.0)
195-
actionpack (>= 7.0.0)
196-
activesupport (>= 7.0.0)
197-
rack
198-
railties (>= 7.0.0)
199193
psych (5.1.2)
200194
stringio
201195
public_suffix (5.0.4)

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Besides `base_controller_class`, you can also set the following for `MissionCont
5757
- `internal_query_count_limit`: in count queries, the maximum number of records that will be counted if the adapter needs to limit these queries. True counts above this number will be returned as `INFINITY`. This keeps count queries fast—defaults to `500,000`
5858
- `scheduled_job_delay_threshold`: the time duration before a scheduled job is considered delayed. Defaults to `1.minute` (a job is considered delayed if it hasn't transitioned from the `scheduled` status 1 minute after the scheduled time).
5959
- `show_console_help`: whether to show the console help. If you don't want the console help message, set this to `false`—defaults to `true`.
60+
- `backtrace_cleaner`: a backtrace cleaner used for optionally filtering backtraces on the Failed Jobs detail page. Defaults to `Rails::BacktraceCleaner.new`. See the [Advanced configuration](#advanced-configuration) section for how to configure/override this setting on a per application/server basis.
6061

6162
This library extends Active Job with a querying interface and the following setting:
6263
- `config.active_job.default_page_size`: the internal batch size that Active Job will use when sending queries to the underlying adapter and the batch size for the bulk operations defined above—defaults to `1000`.
@@ -107,7 +108,24 @@ SERVERS_BY_APP.each do |app, servers|
107108
ActiveJob::QueueAdapters::SolidQueueAdapter.new
108109
end
109110

110-
[ server, queue_adapter ]
111+
# Default:
112+
#
113+
# @return Array<String, ActiveJob::QueueAdapters::Base)
114+
# An array where:
115+
# * the String represents the symbolic name for this server within the UI
116+
# * ActiveJob::QueueAdapters::Base adapter instance used to access this Application Server/Service
117+
[ server, queue_adapter ]
118+
119+
# Optional return formats:
120+
#
121+
# @return Array<String, Array<ActiveJob::QueueAdapters::Base>>
122+
# * This is equivalent, and behaves identically to, the format the default format above.
123+
# [ server, [ queue_adapter ]] # without optional backtrace cleaner
124+
#
125+
# @return Array<String, Array<ActiveJob::QueueAdapters::Base, ActiveSupport::BacktraceCleaner>>
126+
# * This format adds an optional ActiveSupport::BacktraceCleaner to override the system wide
127+
# backtrace cleaner for *this* Application Server/Service.
128+
# [ server, [ queue_adapter, BacktraceCleaner.new ]] # with optional backtrace cleaner
111129
end.to_h
112130

113131
MissionControl::Jobs.applications.add(app, queue_adapters_by_name)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//= link_directory ../stylesheets/mission_control/jobs .css
2+
//= link_directory ../../javascript/mission_control/jobs .js
3+
//= link_directory ../../javascript/mission_control/jobs/controllers .js
4+
//= link_directory ../../javascript/mission_control/jobs/helpers .js
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
1-
@import url("./forms.css");
2-
@import url("./jobs.css");
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/
16+

app/controllers/mission_control/jobs/application_controller.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
class MissionControl::Jobs::ApplicationController < MissionControl::Jobs.base_controller_class.constantize
2-
ActionController::Base::MODULES.each do |mod|
3-
include mod unless self < mod
4-
end
5-
62
layout "mission_control/jobs/application"
73

8-
# Include helpers if not already included
9-
helper MissionControl::Jobs::ApplicationHelper unless self < MissionControl::Jobs::ApplicationHelper
10-
helper Importmap::ImportmapTagsHelper unless self < Importmap::ImportmapTagsHelper
11-
124
include MissionControl::Jobs::ApplicationScoped, MissionControl::Jobs::NotFoundRedirections
135
include MissionControl::Jobs::AdapterFeatures
146

app/controllers/mission_control/jobs/jobs_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def show
1515
end
1616

1717
private
18+
1819
def jobs_relation
1920
filtered_jobs
2021
end

app/helpers/mission_control/jobs/jobs_helper.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@ def failed_job_error(job)
1111
"#{job.last_execution_error.error_class}: #{job.last_execution_error.message}"
1212
end
1313

14-
def failed_job_backtrace(job)
15-
job.last_execution_error.backtrace.join("\n")
14+
def clean_backtrace?
15+
params["clean_backtrace"] == "true"
16+
end
17+
18+
def failed_job_backtrace(job, server)
19+
if clean_backtrace? && server&.backtrace_cleaner
20+
server.backtrace_cleaner.clean(job.last_execution_error.backtrace).join("\n")
21+
else
22+
job.last_execution_error.backtrace.join("\n")
23+
end
1624
end
1725

1826
def attribute_names_for_job_status(status)
@@ -31,6 +39,7 @@ def job_delayed?(job)
3139
end
3240

3341
private
42+
3443
def renderable_job_arguments_for(job)
3544
job.serialized_arguments.collect do |argument|
3645
as_renderable_argument(argument)

app/views/layouts/mission_control/jobs/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<meta name="viewport" content="width=device-width,initial-scale=1">
99
<meta name="turbo-cache-control" content="no-cache">
10-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
10+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.1/css/bulma.min.css">
1111
<%= stylesheet_link_tag "mission_control/jobs/application", "data-turbo-track": "reload" %>
1212
<%= javascript_importmap_tags "application", importmap: MissionControl::Jobs.importmap %>
1313
</head>

app/views/mission_control/jobs/jobs/_error_information.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@
1414
</tbody>
1515
</table>
1616

17-
<pre class="is-family-monospace mb-4"><%= failed_job_backtrace(job) %></pre>
17+
<% if @server.backtrace_cleaner %>
18+
<%= render "mission_control/jobs/jobs/failed/backtrace_toggle", application: @application, job: job %>
19+
<% end %>
20+
21+
<pre class="is-family-monospace mb-4 backtrace-content"><%= failed_job_backtrace(job, @server) %></pre>
1822
<% end %>

0 commit comments

Comments
 (0)