sidekiq-instrumental 0.3.1 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.github/PULL_REQUEST_TEMPLATE.md +24 -0
 - data/.github/workflows/prs.yml +39 -0
 - data/.gitignore +1 -0
 - data/CHANGELOG.md +13 -0
 - data/bin/setup-rubygems.sh +1 -1
 - data/gemfiles/Gemfile.base +4 -0
 - data/gemfiles/Gemfile.sidekiq4 +4 -0
 - data/gemfiles/Gemfile.sidekiq5 +4 -0
 - data/lib/sidekiq/instrumental/middleware/base.rb +31 -1
 - data/lib/sidekiq/instrumental/middleware/client.rb +2 -1
 - data/lib/sidekiq/instrumental/middleware/server.rb +3 -1
 - data/lib/sidekiq/instrumental/version.rb +1 -1
 - data/sidekiq-instrumental.gemspec +2 -3
 - data/spec/sidekiq/instrumental/middleware/client_spec.rb +78 -2
 - data/spec/sidekiq/instrumental/middleware/server_spec.rb +78 -2
 - metadata +23 -27
 - data/.circleci/config.yml +0 -135
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d14f250c271b145a6c61534eff188d74ed8f8382d57ab5528222a3a2bb924756
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8dddb6c4aa02f3d71f6e43ed09e78d9f3da62f6ab3c453eed266ca15fa7c4ef7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f4e2f11e879c4c6af1fc88a1df84cc8ce2bb373ba7c1c7c8ce2674e1997a793c361ecd77fe9d539002e387aebae8e66cfe48d186a4ba889da2f7e978776c8b4a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: dcaa77759c298e69e5400b72cf0cddcdb479430e21786a15a020c6b647393fd773c9359aa950a38b127714644aa398708d0756220c159bb3dc5693cc620d3cc7
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## Change description
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            > Please include a summary of the change and which issue is fixed. Please also include
         
     | 
| 
      
 4 
     | 
    
         
            +
              relevant motivation and context. List any dependencies that are required for this change.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Related issues
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            - Source: <Issue link or Spec Link>
         
     | 
| 
      
 9 
     | 
    
         
            +
            - UAT: <UAT Link>
         
     | 
| 
      
 10 
     | 
    
         
            +
            - QA: <QA Task Link here>
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Review app: <Link to Heroku>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## Checklists
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ### Development
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            - [ ] The commit message follows our [guidelines](https://docs.hubstaff.com/hubstaff-docs/latest/great_commit_messages.html)
         
     | 
| 
      
 18 
     | 
    
         
            +
            - [ ] I have performed a self-review of my own code
         
     | 
| 
      
 19 
     | 
    
         
            +
            - [ ] I have thoroughly tested the changes
         
     | 
| 
      
 20 
     | 
    
         
            +
            - [ ] I have added tests that prove my fix is effective or that my feature works
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ### Security
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            - [ ] Security impact of change has been considered
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: CI PR Builds
         
     | 
| 
      
 3 
     | 
    
         
            +
            'on':
         
     | 
| 
      
 4 
     | 
    
         
            +
              push:
         
     | 
| 
      
 5 
     | 
    
         
            +
                branches:
         
     | 
| 
      
 6 
     | 
    
         
            +
                  - master
         
     | 
| 
      
 7 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 8 
     | 
    
         
            +
            concurrency:
         
     | 
| 
      
 9 
     | 
    
         
            +
              group: ci-${{ github.ref }}
         
     | 
| 
      
 10 
     | 
    
         
            +
              cancel-in-progress: true
         
     | 
| 
      
 11 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 12 
     | 
    
         
            +
              test:
         
     | 
| 
      
 13 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 14 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 15 
     | 
    
         
            +
                  fail-fast: false
         
     | 
| 
      
 16 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 17 
     | 
    
         
            +
                    ruby:
         
     | 
| 
      
 18 
     | 
    
         
            +
                      - '2.5'
         
     | 
| 
      
 19 
     | 
    
         
            +
                      - '2.7'
         
     | 
| 
      
 20 
     | 
    
         
            +
                    sidekiq:
         
     | 
| 
      
 21 
     | 
    
         
            +
                      - '4'
         
     | 
| 
      
 22 
     | 
    
         
            +
                      - '5'
         
     | 
| 
      
 23 
     | 
    
         
            +
                env:
         
     | 
| 
      
 24 
     | 
    
         
            +
                  BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/Gemfile.sidekiq${{ matrix.sidekiq }}"
         
     | 
| 
      
 25 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - uses: actions/checkout@v2
         
     | 
| 
      
 27 
     | 
    
         
            +
                  - name: Set up Ruby
         
     | 
| 
      
 28 
     | 
    
         
            +
                    uses: ruby/setup-ruby@v1
         
     | 
| 
      
 29 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 30 
     | 
    
         
            +
                      ruby-version: "${{ matrix.ruby }}"
         
     | 
| 
      
 31 
     | 
    
         
            +
                      bundler-cache: true
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - name: Run bundle update
         
     | 
| 
      
 33 
     | 
    
         
            +
                    run: bundle update
         
     | 
| 
      
 34 
     | 
    
         
            +
                  - name: Run tests
         
     | 
| 
      
 35 
     | 
    
         
            +
                    run: bundle exec rake spec
         
     | 
| 
      
 36 
     | 
    
         
            +
                  - name: Rubocop
         
     | 
| 
      
 37 
     | 
    
         
            +
                    run: bundle exec rubocop
         
     | 
| 
      
 38 
     | 
    
         
            +
                  - name: Build gem
         
     | 
| 
      
 39 
     | 
    
         
            +
                    run: gem build *.gemspec
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. 
     | 
|
| 
       9 
9 
     | 
    
         
             
            ### Changed
         
     | 
| 
       10 
10 
     | 
    
         
             
            ### Fixed
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            ## [0.3.4]
         
     | 
| 
      
 13 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 14 
     | 
    
         
            +
            - cover multiple possible returns types of display_class
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## [0.3.3]
         
     | 
| 
      
 17 
     | 
    
         
            +
            ### Fixed
         
     | 
| 
      
 18 
     | 
    
         
            +
            - Fix unwrap_class_name, it was wrongly expecting an instance not a class.
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ## [0.3.2]
         
     | 
| 
      
 21 
     | 
    
         
            +
            ### Added
         
     | 
| 
      
 22 
     | 
    
         
            +
            - Implement a custom version of Sidekiq's display\_class\_name that fix an issues with ActiveJob > 6 when the job's class is passed as class not String
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Limit support up to Sidekiq < 6. 
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       12 
25 
     | 
    
         
             
            ## [0.3.1]
         
     | 
| 
       13 
26 
     | 
    
         
             
            ### Fixed
         
     | 
| 
       14 
27 
     | 
    
         
             
            - class name calculation needs to filter out unsupported characters by instrumental
         
     | 
    
        data/bin/setup-rubygems.sh
    CHANGED
    
    
| 
         @@ -41,12 +41,42 @@ module Sidekiq 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                    def build_class_key(klass_name)
         
     | 
| 
       44 
     | 
    
         
            -
                      key = klass_name 
     | 
| 
      
 44 
     | 
    
         
            +
                      key = underscore(klass_name)
         
     | 
| 
       45 
45 
     | 
    
         
             
                              .gsub(/[^\d\w\-_\.]/, '_')
         
     | 
| 
       46 
46 
     | 
    
         
             
                              .gsub(/\.{2,}/, '.')
         
     | 
| 
       47 
47 
     | 
    
         
             
                      key.chomp!('.') while key[-1] == '.'
         
     | 
| 
       48 
48 
     | 
    
         
             
                      key
         
     | 
| 
       49 
49 
     | 
    
         
             
                    end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                    # Borrowed from active support so we do not depend on it.
         
     | 
| 
      
 52 
     | 
    
         
            +
                    def underscore(camel_cased_word)
         
     | 
| 
      
 53 
     | 
    
         
            +
                      return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                      word = camel_cased_word.to_s.gsub('::', '/')
         
     | 
| 
      
 56 
     | 
    
         
            +
                      word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
         
     | 
| 
      
 57 
     | 
    
         
            +
                      word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
         
     | 
| 
      
 58 
     | 
    
         
            +
                      word.tr!('-', '_')
         
     | 
| 
      
 59 
     | 
    
         
            +
                      word.downcase!
         
     | 
| 
      
 60 
     | 
    
         
            +
                      word
         
     | 
| 
      
 61 
     | 
    
         
            +
                    end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                    # Returns the human-friendly class name, if its a known wrapper we unwrap it.
         
     | 
| 
      
 64 
     | 
    
         
            +
                    # Previously, this was done by the +display_name+ method of Sidekiq::Job,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    # but after this change (https://github.com/rails/rails/commit/0e64348ccaf513de731f403259ec5b49e7b3f028)
         
     | 
| 
      
 66 
     | 
    
         
            +
                    # the method (https://github.com/mperham/sidekiq/blob/main/lib/sidekiq/api.rb#L342)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    # no longer works as expected as it compares a class against a string,
         
     | 
| 
      
 68 
     | 
    
         
            +
                    # returning the wrapped job class not the class behind it as String.
         
     | 
| 
      
 69 
     | 
    
         
            +
                    def unwrap_class_name(job)
         
     | 
| 
      
 70 
     | 
    
         
            +
                      display_class = job.display_class
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                      if %w[ActionMailer::DeliveryJob ActionMailer::MailDeliveryJob]
         
     | 
| 
      
 73 
     | 
    
         
            +
                           .include?(display_class.to_s)
         
     | 
| 
      
 74 
     | 
    
         
            +
                        # The class name was not unwrapped correctly by the +display_class+ method
         
     | 
| 
      
 75 
     | 
    
         
            +
                        job.args[0]['arguments'][0..1].join('#')
         
     | 
| 
      
 76 
     | 
    
         
            +
                      else
         
     | 
| 
      
 77 
     | 
    
         
            +
                        display_class.to_s
         
     | 
| 
      
 78 
     | 
    
         
            +
                      end
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
       50 
80 
     | 
    
         
             
                  end
         
     | 
| 
       51 
81 
     | 
    
         
             
                end
         
     | 
| 
       52 
82 
     | 
    
         
             
              end
         
     | 
| 
         @@ -13,7 +13,8 @@ module Sidekiq 
     | 
|
| 
       13 
13 
     | 
    
         
             
                      base_key = "sidekiq.#{queue}."
         
     | 
| 
       14 
14 
     | 
    
         
             
                      increment(base_key + 'queued')
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                       
     | 
| 
      
 16 
     | 
    
         
            +
                      display_class = unwrap_class_name(msg)
         
     | 
| 
      
 17 
     | 
    
         
            +
                      base_key += build_class_key(display_class) + '.'
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
                      increment(base_key + 'queued')
         
     | 
| 
       19 
20 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -18,7 +18,9 @@ module Sidekiq 
     | 
|
| 
       18 
18 
     | 
    
         
             
                      gauge(base_key + 'time', elapsed)
         
     | 
| 
       19 
19 
     | 
    
         
             
                      gauge(base_key + 'enqueued', stats.queues[queue].to_i)
         
     | 
| 
       20 
20 
     | 
    
         
             
                      gauge(base_key + 'latency', Sidekiq::Queue.new(queue.to_s).latency)
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                      display_class = unwrap_class_name(msg)
         
     | 
| 
      
 23 
     | 
    
         
            +
                      base_key += build_class_key(display_class) + '.'
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
                      increment(base_key + 'processed')
         
     | 
| 
       24 
26 
     | 
    
         
             
                      gauge(base_key + 'time', elapsed)
         
     | 
| 
         @@ -24,10 +24,9 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       24 
24 
     | 
    
         
             
              spec.required_ruby_version = '>= 2.3'
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              spec.add_runtime_dependency 'instrumental_agent', '>= 0.13'
         
     | 
| 
       27 
     | 
    
         
            -
              spec.add_runtime_dependency 'sidekiq', '>=  
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_runtime_dependency 'sidekiq', '>= 4.0', '< 6.0'
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
              spec.add_development_dependency ' 
     | 
| 
       30 
     | 
    
         
            -
              spec.add_development_dependency 'bundler', '~> 1.9'
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_development_dependency 'bundler'
         
     | 
| 
       31 
30 
     | 
    
         
             
              spec.add_development_dependency 'rake', '>= 10.0'
         
     | 
| 
       32 
31 
     | 
    
         
             
              spec.add_development_dependency 'rspec', '~> 3.4'
         
     | 
| 
       33 
32 
     | 
    
         
             
              spec.add_development_dependency 'simplecov', '~> 0.11'
         
     | 
| 
         @@ -2,8 +2,6 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            require 'active_support/core_ext/string/inflections'
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
5 
     | 
    
         
             
            RSpec.describe Sidekiq::Instrumental::Middleware::Client do
         
     | 
| 
       8 
6 
     | 
    
         
             
              let(:config) { Sidekiq::Instrumental::Configuration.new }
         
     | 
| 
       9 
7 
     | 
    
         
             
              let(:middleware) { described_class.new(config) }
         
     | 
| 
         @@ -71,6 +69,16 @@ RSpec.describe Sidekiq::Instrumental::Middleware::Client do 
     | 
|
| 
       71 
69 
     | 
    
         
             
                    subject
         
     | 
| 
       72 
70 
     | 
    
         
             
                  end
         
     | 
| 
       73 
71 
     | 
    
         
             
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                context 'when the class is not passed as a string' do
         
     | 
| 
      
 74 
     | 
    
         
            +
                  let(:msg) { { 'class' => stub_const('MyClassName', Class.new) } }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  it 'increments the queued metric for the queue' do
         
     | 
| 
      
 77 
     | 
    
         
            +
                    expect(middleware).to receive(:increment).with("sidekiq.#{queue}.queued")
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                    subject
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
       74 
82 
     | 
    
         
             
              end
         
     | 
| 
       75 
83 
     | 
    
         | 
| 
       76 
84 
     | 
    
         
             
              it 'calls display_class to get the class name' do
         
     | 
| 
         @@ -86,4 +94,72 @@ RSpec.describe Sidekiq::Instrumental::Middleware::Client do 
     | 
|
| 
       86 
94 
     | 
    
         | 
| 
       87 
95 
     | 
    
         
             
                subject
         
     | 
| 
       88 
96 
     | 
    
         
             
              end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
              describe 'Unwrap sidekiq job class name' do
         
     | 
| 
      
 99 
     | 
    
         
            +
                let(:msg) do
         
     | 
| 
      
 100 
     | 
    
         
            +
                  {
         
     | 
| 
      
 101 
     | 
    
         
            +
                    'class' => 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper',
         
     | 
| 
      
 102 
     | 
    
         
            +
                    'wrapped' => passed_class,
         
     | 
| 
      
 103 
     | 
    
         
            +
                    'args' => args
         
     | 
| 
      
 104 
     | 
    
         
            +
                  }
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
                let(:args) { [] }
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                context "when sidekiq's wrapped class is a mail delivery job" do
         
     | 
| 
      
 109 
     | 
    
         
            +
                  let(:wrapped_class) { stub_const('ActionMailer::DeliveryJob', Class.new) }
         
     | 
| 
      
 110 
     | 
    
         
            +
                  let(:args) { [{ 'arguments' => %w[UserMailer confirm_account deliver_now User] }] }
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                  context 'when passed as a String' do
         
     | 
| 
      
 113 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class.to_s }
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 116 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 117 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 118 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.user_mailer_confirm_account.queued")
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 121 
     | 
    
         
            +
                    end
         
     | 
| 
      
 122 
     | 
    
         
            +
                  end
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                  context 'when passed as a Class' do
         
     | 
| 
      
 125 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class }
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 128 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 129 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 130 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.user_mailer_confirm_account.queued")
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 133 
     | 
    
         
            +
                    end
         
     | 
| 
      
 134 
     | 
    
         
            +
                  end
         
     | 
| 
      
 135 
     | 
    
         
            +
                end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                context "when sidekiq's wrapped class is not a mail delivery job" do
         
     | 
| 
      
 138 
     | 
    
         
            +
                  let(:wrapped_class) { stub_const('Jobs::Job', Class.new) }
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                  context 'when passed as a String' do
         
     | 
| 
      
 141 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class.to_s }
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 144 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 145 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 146 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.jobs_job.queued")
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 149 
     | 
    
         
            +
                    end
         
     | 
| 
      
 150 
     | 
    
         
            +
                  end
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
                  context 'when passed as a Class' do
         
     | 
| 
      
 153 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class }
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 156 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 157 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 158 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.jobs_job.queued")
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 161 
     | 
    
         
            +
                    end
         
     | 
| 
      
 162 
     | 
    
         
            +
                  end
         
     | 
| 
      
 163 
     | 
    
         
            +
                end
         
     | 
| 
      
 164 
     | 
    
         
            +
              end
         
     | 
| 
       89 
165 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,8 +2,6 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            require 'active_support/core_ext/string/inflections'
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
5 
     | 
    
         
             
            RSpec.describe Sidekiq::Instrumental::Middleware::Server do
         
     | 
| 
       8 
6 
     | 
    
         
             
              let(:config) { Sidekiq::Instrumental::Configuration.new }
         
     | 
| 
       9 
7 
     | 
    
         
             
              let(:middleware) { described_class.new(config) }
         
     | 
| 
         @@ -124,6 +122,16 @@ RSpec.describe Sidekiq::Instrumental::Middleware::Server do 
     | 
|
| 
       124 
122 
     | 
    
         
             
                    subject
         
     | 
| 
       125 
123 
     | 
    
         
             
                  end
         
     | 
| 
       126 
124 
     | 
    
         
             
                end
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
                context 'when the class is not passed as a string' do
         
     | 
| 
      
 127 
     | 
    
         
            +
                  let(:msg) { { 'class' => stub_const('MyClassName', Class.new) } }
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                  it 'increments the queued metric for the queue' do
         
     | 
| 
      
 130 
     | 
    
         
            +
                    expect(middleware).to receive(:increment).with("sidekiq.#{queue}.processed")
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                    subject
         
     | 
| 
      
 133 
     | 
    
         
            +
                  end
         
     | 
| 
      
 134 
     | 
    
         
            +
                end
         
     | 
| 
       127 
135 
     | 
    
         
             
              end
         
     | 
| 
       128 
136 
     | 
    
         | 
| 
       129 
137 
     | 
    
         
             
              it 'gauge elapsed time metric for the class' do
         
     | 
| 
         @@ -135,4 +143,72 @@ RSpec.describe Sidekiq::Instrumental::Middleware::Server do 
     | 
|
| 
       135 
143 
     | 
    
         | 
| 
       136 
144 
     | 
    
         
             
                subject
         
     | 
| 
       137 
145 
     | 
    
         
             
              end
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
              describe 'Unwrap sidekiq job class name' do
         
     | 
| 
      
 148 
     | 
    
         
            +
                let(:msg) do
         
     | 
| 
      
 149 
     | 
    
         
            +
                  {
         
     | 
| 
      
 150 
     | 
    
         
            +
                    'class' => 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper',
         
     | 
| 
      
 151 
     | 
    
         
            +
                    'wrapped' => passed_class,
         
     | 
| 
      
 152 
     | 
    
         
            +
                    'args' => args
         
     | 
| 
      
 153 
     | 
    
         
            +
                  }
         
     | 
| 
      
 154 
     | 
    
         
            +
                end
         
     | 
| 
      
 155 
     | 
    
         
            +
                let(:args) { [] }
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                context "when sidekiq's wrapped class is a mail delivery job" do
         
     | 
| 
      
 158 
     | 
    
         
            +
                  let(:wrapped_class) { stub_const('ActionMailer::DeliveryJob', Class.new) }
         
     | 
| 
      
 159 
     | 
    
         
            +
                  let(:args) { [{ 'arguments' => %w[UserMailer confirm_account deliver_now User] }] }
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                  context 'when passed as a String' do
         
     | 
| 
      
 162 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class.to_s }
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 165 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 166 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 167 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.user_mailer_confirm_account.processed")
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 170 
     | 
    
         
            +
                    end
         
     | 
| 
      
 171 
     | 
    
         
            +
                  end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                  context 'when passed as a Class' do
         
     | 
| 
      
 174 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class }
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 177 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 178 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 179 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.user_mailer_confirm_account.processed")
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 182 
     | 
    
         
            +
                    end
         
     | 
| 
      
 183 
     | 
    
         
            +
                  end
         
     | 
| 
      
 184 
     | 
    
         
            +
                end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                context "when sidekiq's wrapped class is not a mail delivery job" do
         
     | 
| 
      
 187 
     | 
    
         
            +
                  let(:wrapped_class) { stub_const('Jobs::Job', Class.new) }
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
                  context 'when passed as a String' do
         
     | 
| 
      
 190 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class.to_s }
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 193 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 194 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 195 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.jobs_job.processed")
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 198 
     | 
    
         
            +
                    end
         
     | 
| 
      
 199 
     | 
    
         
            +
                  end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                  context 'when passed as a Class' do
         
     | 
| 
      
 202 
     | 
    
         
            +
                    let(:passed_class) { wrapped_class }
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                    it 'unwraps the class name and increments the metric' do
         
     | 
| 
      
 205 
     | 
    
         
            +
                      expect(middleware)
         
     | 
| 
      
 206 
     | 
    
         
            +
                        .to receive(:increment)
         
     | 
| 
      
 207 
     | 
    
         
            +
                              .with("sidekiq.#{queue}.jobs_job.processed")
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                      subject
         
     | 
| 
      
 210 
     | 
    
         
            +
                    end
         
     | 
| 
      
 211 
     | 
    
         
            +
                  end
         
     | 
| 
      
 212 
     | 
    
         
            +
                end
         
     | 
| 
      
 213 
     | 
    
         
            +
              end
         
     | 
| 
       138 
214 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sidekiq-instrumental
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Edward Rudd
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-05-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: instrumental_agent
         
     | 
| 
         @@ -30,42 +30,34 @@ dependencies: 
     | 
|
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - ">="
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
                - - "<"
         
     | 
| 
      
 35 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 36 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
       34 
37 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
38 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
39 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
41 
     | 
    
         
             
                - - ">="
         
     | 
| 
       39 
42 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
       41 
     | 
    
         
            -
            -  
     | 
| 
       42 
     | 
    
         
            -
              name: activesupport
         
     | 
| 
       43 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
     | 
    
         
            -
                requirements:
         
     | 
| 
       45 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
      
 43 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
      
 44 
     | 
    
         
            +
                - - "<"
         
     | 
| 
       46 
45 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: ' 
     | 
| 
       48 
     | 
    
         
            -
              type: :development
         
     | 
| 
       49 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       50 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
     | 
    
         
            -
                requirements:
         
     | 
| 
       52 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       53 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: '5.0'
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
       55 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
48 
     | 
    
         
             
              name: bundler
         
     | 
| 
       57 
49 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
50 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - " 
     | 
| 
      
 51 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       60 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 53 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       62 
54 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
55 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
56 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
57 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
     | 
    
         
            -
                - - " 
     | 
| 
      
 58 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       67 
59 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 60 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       69 
61 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
62 
     | 
    
         
             
              name: rake
         
     | 
| 
       71 
63 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -150,14 +142,15 @@ dependencies: 
     | 
|
| 
       150 
142 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       151 
143 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       152 
144 
     | 
    
         
             
                    version: 1.37.1
         
     | 
| 
       153 
     | 
    
         
            -
            description: 
     | 
| 
      
 145 
     | 
    
         
            +
            description:
         
     | 
| 
       154 
146 
     | 
    
         
             
            email:
         
     | 
| 
       155 
147 
     | 
    
         
             
            - urkle@outoforder.cc
         
     | 
| 
       156 
148 
     | 
    
         
             
            executables: []
         
     | 
| 
       157 
149 
     | 
    
         
             
            extensions: []
         
     | 
| 
       158 
150 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       159 
151 
     | 
    
         
             
            files:
         
     | 
| 
       160 
     | 
    
         
            -
            - ". 
     | 
| 
      
 152 
     | 
    
         
            +
            - ".github/PULL_REQUEST_TEMPLATE.md"
         
     | 
| 
      
 153 
     | 
    
         
            +
            - ".github/workflows/prs.yml"
         
     | 
| 
       161 
154 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       162 
155 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       163 
156 
     | 
    
         
             
            - ".rubocop.yml"
         
     | 
| 
         @@ -171,6 +164,9 @@ files: 
     | 
|
| 
       171 
164 
     | 
    
         
             
            - bin/setup
         
     | 
| 
       172 
165 
     | 
    
         
             
            - bin/setup-rubygems.sh
         
     | 
| 
       173 
166 
     | 
    
         
             
            - bin/tag_check.sh
         
     | 
| 
      
 167 
     | 
    
         
            +
            - gemfiles/Gemfile.base
         
     | 
| 
      
 168 
     | 
    
         
            +
            - gemfiles/Gemfile.sidekiq4
         
     | 
| 
      
 169 
     | 
    
         
            +
            - gemfiles/Gemfile.sidekiq5
         
     | 
| 
       174 
170 
     | 
    
         
             
            - lib/sidekiq/instrumental.rb
         
     | 
| 
       175 
171 
     | 
    
         
             
            - lib/sidekiq/instrumental/configuration.rb
         
     | 
| 
       176 
172 
     | 
    
         
             
            - lib/sidekiq/instrumental/middleware/base.rb
         
     | 
| 
         @@ -187,7 +183,7 @@ homepage: https://github.com/NetsoftHoldings/sidekiq-instrumental/ 
     | 
|
| 
       187 
183 
     | 
    
         
             
            licenses:
         
     | 
| 
       188 
184 
     | 
    
         
             
            - MIT
         
     | 
| 
       189 
185 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       190 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 186 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       191 
187 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       192 
188 
     | 
    
         
             
            require_paths:
         
     | 
| 
       193 
189 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -202,8 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       202 
198 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       203 
199 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       204 
200 
     | 
    
         
             
            requirements: []
         
     | 
| 
       205 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       206 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 201 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
      
 202 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       207 
203 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       208 
204 
     | 
    
         
             
            summary: Send Sidekiq status into Instrumental after every job
         
     | 
| 
       209 
205 
     | 
    
         
             
            test_files:
         
     | 
    
        data/.circleci/config.yml
    DELETED
    
    | 
         @@ -1,135 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            version: 2
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            defaults: &defaults
         
     | 
| 
       4 
     | 
    
         
            -
              docker: &ruby_image
         
     | 
| 
       5 
     | 
    
         
            -
                - &ruby_image
         
     | 
| 
       6 
     | 
    
         
            -
                  image: circleci/ruby:2.5-stretch
         
     | 
| 
       7 
     | 
    
         
            -
                  environment:
         
     | 
| 
       8 
     | 
    
         
            -
                    RUBYOPT: '-KU -E utf-8:utf-8'
         
     | 
| 
       9 
     | 
    
         
            -
                    BUNDLE_PATH: vendor/bundle
         
     | 
| 
       10 
     | 
    
         
            -
                    BUNDLE_VERSION: 1.17.3
         
     | 
| 
       11 
     | 
    
         
            -
                    BUNDLE_JOBS: 4
         
     | 
| 
       12 
     | 
    
         
            -
                    BUNDLE_RETRY: 3
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            filters:
         
     | 
| 
       15 
     | 
    
         
            -
              test: &filter_test
         
     | 
| 
       16 
     | 
    
         
            -
                filters:
         
     | 
| 
       17 
     | 
    
         
            -
                  tags:
         
     | 
| 
       18 
     | 
    
         
            -
                    ignore: /^v.*/
         
     | 
| 
       19 
     | 
    
         
            -
              beta: &filter_beta
         
     | 
| 
       20 
     | 
    
         
            -
                filters:
         
     | 
| 
       21 
     | 
    
         
            -
                  branches:
         
     | 
| 
       22 
     | 
    
         
            -
                    ignore: /.*/
         
     | 
| 
       23 
     | 
    
         
            -
                  tags:
         
     | 
| 
       24 
     | 
    
         
            -
                    only: /^v[0-9]+(\.[0-9]+)+(\.[a-z].+).*/
         
     | 
| 
       25 
     | 
    
         
            -
              release: &filter_release
         
     | 
| 
       26 
     | 
    
         
            -
                filters:
         
     | 
| 
       27 
     | 
    
         
            -
                  branches:
         
     | 
| 
       28 
     | 
    
         
            -
                    ignore: /.*/
         
     | 
| 
       29 
     | 
    
         
            -
                  tags:
         
     | 
| 
       30 
     | 
    
         
            -
                    only: /^v[0-9]+(\.[0-9]+)+/
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            workflows:
         
     | 
| 
       33 
     | 
    
         
            -
              version: 2
         
     | 
| 
       34 
     | 
    
         
            -
              build_test:
         
     | 
| 
       35 
     | 
    
         
            -
                jobs:
         
     | 
| 
       36 
     | 
    
         
            -
                  - "Checkout":
         
     | 
| 
       37 
     | 
    
         
            -
                      <<: *filter_test
         
     | 
| 
       38 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       39 
     | 
    
         
            -
                  - "Test":
         
     | 
| 
       40 
     | 
    
         
            -
                      <<: *filter_test
         
     | 
| 
       41 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       42 
     | 
    
         
            -
                      requires:
         
     | 
| 
       43 
     | 
    
         
            -
                        - "Checkout"
         
     | 
| 
       44 
     | 
    
         
            -
              build_test_beta:
         
     | 
| 
       45 
     | 
    
         
            -
                jobs:
         
     | 
| 
       46 
     | 
    
         
            -
                  - "Checkout":
         
     | 
| 
       47 
     | 
    
         
            -
                      <<: *filter_beta
         
     | 
| 
       48 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       49 
     | 
    
         
            -
                  - "Test":
         
     | 
| 
       50 
     | 
    
         
            -
                      <<: *filter_beta
         
     | 
| 
       51 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       52 
     | 
    
         
            -
                      requires:
         
     | 
| 
       53 
     | 
    
         
            -
                        - "Checkout"
         
     | 
| 
       54 
     | 
    
         
            -
                  - "Publish":
         
     | 
| 
       55 
     | 
    
         
            -
                      <<: *filter_beta
         
     | 
| 
       56 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       57 
     | 
    
         
            -
                      requires:
         
     | 
| 
       58 
     | 
    
         
            -
                        - "Test"
         
     | 
| 
       59 
     | 
    
         
            -
              build_test_release:
         
     | 
| 
       60 
     | 
    
         
            -
                jobs:
         
     | 
| 
       61 
     | 
    
         
            -
                  - "Checkout":
         
     | 
| 
       62 
     | 
    
         
            -
                      <<: *filter_release
         
     | 
| 
       63 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       64 
     | 
    
         
            -
                  - "Test":
         
     | 
| 
       65 
     | 
    
         
            -
                      <<: *filter_release
         
     | 
| 
       66 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       67 
     | 
    
         
            -
                      requires:
         
     | 
| 
       68 
     | 
    
         
            -
                        - "Checkout"
         
     | 
| 
       69 
     | 
    
         
            -
                  - "Publish":
         
     | 
| 
       70 
     | 
    
         
            -
                      <<: *filter_release
         
     | 
| 
       71 
     | 
    
         
            -
                      context: org-global
         
     | 
| 
       72 
     | 
    
         
            -
                      requires:
         
     | 
| 
       73 
     | 
    
         
            -
                        - "Test"
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
            jobs:
         
     | 
| 
       76 
     | 
    
         
            -
              "Checkout":
         
     | 
| 
       77 
     | 
    
         
            -
                <<: *defaults
         
     | 
| 
       78 
     | 
    
         
            -
                steps:
         
     | 
| 
       79 
     | 
    
         
            -
                  - attach_workspace:
         
     | 
| 
       80 
     | 
    
         
            -
                      at: .
         
     | 
| 
       81 
     | 
    
         
            -
                  - checkout
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                  - restore_cache:
         
     | 
| 
       84 
     | 
    
         
            -
                      keys:
         
     | 
| 
       85 
     | 
    
         
            -
                        - sidekiq-instrumental-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "sidekiq-instrumental.gemspec" }}
         
     | 
| 
       86 
     | 
    
         
            -
                  - run:
         
     | 
| 
       87 
     | 
    
         
            -
                      name: Install bundler
         
     | 
| 
       88 
     | 
    
         
            -
                      command: gem install bundler --version=$BUNDLE_VERSION
         
     | 
| 
       89 
     | 
    
         
            -
                  - run:
         
     | 
| 
       90 
     | 
    
         
            -
                      name: Bundle Install
         
     | 
| 
       91 
     | 
    
         
            -
                      command: |-
         
     | 
| 
       92 
     | 
    
         
            -
                        bundle _${BUNDLE_VERSION}_ check || bundle _${BUNDLE_VERSION}_ install --retry=$BUNDLE_RETRY
         
     | 
| 
       93 
     | 
    
         
            -
                  - save_cache:
         
     | 
| 
       94 
     | 
    
         
            -
                      key: sidekiq-instrumental-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "sidekiq-instrumental.gemspec" }}
         
     | 
| 
       95 
     | 
    
         
            -
                      paths:
         
     | 
| 
       96 
     | 
    
         
            -
                        - vendor/bundle
         
     | 
| 
       97 
     | 
    
         
            -
                        - Gemfile.lock
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                  - persist_to_workspace:
         
     | 
| 
       100 
     | 
    
         
            -
                      root: .
         
     | 
| 
       101 
     | 
    
         
            -
                      paths: .
         
     | 
| 
       102 
     | 
    
         
            -
              "Test":
         
     | 
| 
       103 
     | 
    
         
            -
                <<: *defaults
         
     | 
| 
       104 
     | 
    
         
            -
                steps:
         
     | 
| 
       105 
     | 
    
         
            -
                  - attach_workspace:
         
     | 
| 
       106 
     | 
    
         
            -
                      at: .
         
     | 
| 
       107 
     | 
    
         
            -
                  - run:
         
     | 
| 
       108 
     | 
    
         
            -
                      name: Install bundler
         
     | 
| 
       109 
     | 
    
         
            -
                      command: gem install bundler --version=$BUNDLE_VERSION
         
     | 
| 
       110 
     | 
    
         
            -
                  - run:
         
     | 
| 
       111 
     | 
    
         
            -
                      name: RSpec
         
     | 
| 
       112 
     | 
    
         
            -
                      command: bundle exec rspec
         
     | 
| 
       113 
     | 
    
         
            -
                  - run:
         
     | 
| 
       114 
     | 
    
         
            -
                      name: Rubocop
         
     | 
| 
       115 
     | 
    
         
            -
                      command: bundle exec rubocop
         
     | 
| 
       116 
     | 
    
         
            -
                  - run:
         
     | 
| 
       117 
     | 
    
         
            -
                      name: Build gem
         
     | 
| 
       118 
     | 
    
         
            -
                      command: |-
         
     | 
| 
       119 
     | 
    
         
            -
                        gem build *.gemspec
         
     | 
| 
       120 
     | 
    
         
            -
              "Publish":
         
     | 
| 
       121 
     | 
    
         
            -
                <<: *defaults
         
     | 
| 
       122 
     | 
    
         
            -
                steps:
         
     | 
| 
       123 
     | 
    
         
            -
                  - attach_workspace:
         
     | 
| 
       124 
     | 
    
         
            -
                      at: .
         
     | 
| 
       125 
     | 
    
         
            -
                  - run:
         
     | 
| 
       126 
     | 
    
         
            -
                      name: Install bundler
         
     | 
| 
       127 
     | 
    
         
            -
                      command: gem install bundler --version=$BUNDLE_VERSION
         
     | 
| 
       128 
     | 
    
         
            -
                  - run:
         
     | 
| 
       129 
     | 
    
         
            -
                      name: Deploy to gem server
         
     | 
| 
       130 
     | 
    
         
            -
                      command: |-
         
     | 
| 
       131 
     | 
    
         
            -
                        ./bin/tag_check.sh
         
     | 
| 
       132 
     | 
    
         
            -
                        ./bin/setup-rubygems.sh
         
     | 
| 
       133 
     | 
    
         
            -
                        rm -rf pkg
         
     | 
| 
       134 
     | 
    
         
            -
                        rake build
         
     | 
| 
       135 
     | 
    
         
            -
                        gem push pkg/*.gem
         
     |