Skip to content

Commit

Permalink
0.8.1: Compatibility with Sidekiq 6.2.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed Aug 24, 2021
1 parent 4ffad77 commit 22c545a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

## 0.8.1 - 2021-08-24

### Fixed

- Compatibility with Sidekiq 6.2.2+ due to renamings in Sidekiq's undocumented API that yabeda-sidekiq uses. See [mperham/sidekiq#4971](https://github.com/mperham/sidekiq/discussions/4971). [@Envek]

## 0.8.0 - 2021-05-12

### Added
Expand Down
5 changes: 4 additions & 1 deletion lib/yabeda/sidekiq/server_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ module Yabeda
module Sidekiq
# Sidekiq worker middleware
class ServerMiddleware
# See https://github.com/mperham/sidekiq/discussions/4971
JOB_RECORD_CLASS = defined?(::Sidekiq::JobRecord) ? ::Sidekiq::JobRecord : ::Sidekiq::Job

# rubocop: disable Metrics/AbcSize, Metrics/MethodLength:
def call(worker, job, queue)
custom_tags = Yabeda::Sidekiq.custom_tags(worker, job).to_h
labels = Yabeda::Sidekiq.labelize(worker, job, queue).merge(custom_tags)
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
begin
job_instance = ::Sidekiq::Job.new(job)
job_instance = JOB_RECORD_CLASS.new(job)
Yabeda.sidekiq_job_latency.measure(labels, job_instance.latency)
Yabeda::Sidekiq.jobs_started_at[labels][job["jid"]] = start
Yabeda.with_tags(**custom_tags) do
Expand Down
2 changes: 1 addition & 1 deletion lib/yabeda/sidekiq/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Yabeda
module Sidekiq
VERSION = "0.8.0"
VERSION = "0.8.1"
end
end

0 comments on commit 22c545a

Please sign in to comment.