Skip to content

Commit

Permalink
Merge pull request sidekiq#2259 from mperham/better_aj
Browse files Browse the repository at this point in the history
Improve ActiveJob integration
  • Loading branch information
mperham committed Mar 24, 2015
2 parents 2b34b9d + 15df4cb commit a3fe274
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes.md
@@ -1,6 +1,8 @@
HEAD
-----------

- **Improve ActiveJob integration** - Web UI now shows ActiveJobs in a
nicer format and job logging shows the actual class name [#2248, #2259]
- Add Sidekiq::Process#dump\_threads API to trigger TTIN output [#2247]

3.3.3
Expand Down
4 changes: 2 additions & 2 deletions lib/sidekiq/api.rb
Expand Up @@ -283,7 +283,7 @@ def display_class
"#{target}.#{method}"
end
when "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
args[0]
@item['wrapped'] || args[0]
else
klass
end
Expand All @@ -297,7 +297,7 @@ def display_args
arg
end
when "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
args[1..-1]
@item['wrapped'] ? args[0]["arguments"] : []
else
args
end
Expand Down
6 changes: 5 additions & 1 deletion lib/sidekiq/middleware/server/logging.rb
Expand Up @@ -4,7 +4,11 @@ module Server
class Logging

def call(worker, item, queue)
Sidekiq::Logging.with_context("#{worker.class.to_s} JID-#{item['jid']}#{" BID-#{item['bid']}" if item['bid']}") do
# If we're using a wrapper class, like ActiveJob, use the "wrapped"
# attribute to expose the underlying thing.
klass = item['wrapped'] || worker.class.to_s

Sidekiq::Logging.with_context("#{klass} JID-#{item['jid']}#{" BID-#{item['bid']}" if item['bid']}") do
begin
start = Time.now
logger.info { "start" }
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/web_helpers.rb
Expand Up @@ -129,7 +129,7 @@ def display_args(args, truncate_after_chars = 2000)
RETRY_JOB_KEYS = Set.new(%w(
queue class args retry_count retried_at failed_at
jid error_message error_class backtrace
error_backtrace enqueued_at retry
error_backtrace enqueued_at retry wrapped
))

def retry_extra_items(retry_job)
Expand Down

0 comments on commit a3fe274

Please sign in to comment.