Module: Labkit::Middleware::Sidekiq::Tracing::SidekiqCommon
Overview
SidekiqCommon is a mixin for the sidekiq middleware components
Instance Method Summary collapse
Instance Method Details
#job_class(job) ⇒ Object
9 10 11 12 13 |
# File 'lib/labkit/middleware/sidekiq/tracing/sidekiq_common.rb', line 9 def job_class(job) # Active Job wrapping can be found at # https://github.com/rails/rails/blob/v6.0.3.1/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb job["wrapped"].presence || job["class"].presence || "undefined" end |
#tags_from_job(job, kind) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/labkit/middleware/sidekiq/tracing/sidekiq_common.rb', line 19 def (job, kind) = { "component" => "sidekiq", "span.kind" => kind, "sidekiq.wrapped" => wrapped?(job), "sidekiq.queue" => job["queue"], "sidekiq.jid" => job["jid"], "sidekiq.retry" => job["retry"].to_s, "sidekiq.args" => job["args"]&.join(", "), } ["sidekiq.at"] = job["at"] if job["at"] end |
#wrapped?(job) ⇒ Boolean
15 16 17 |
# File 'lib/labkit/middleware/sidekiq/tracing/sidekiq_common.rb', line 15 def wrapped?(job) job["wrapped"].present? end |