sidekiq-skylight 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1d5b9132e6449058fab6057ab5847fde6092f39c
4
+ data.tar.gz: c33cb11479fbdbb9a75b73485486f7da63b6e0f0
5
+ SHA512:
6
+ metadata.gz: 09281b80de0d041c0d1468d2b84e962990dce485ab4707a947139e60495c90eb8e3ff32cd7d1c1a5326417c5ba7465ab74b915f79c5bfd3c5b675f449d0dcd30
7
+ data.tar.gz: f174c0eb6a0790f2781faa27e35a2dfb10a692dc885d1902bc88baafd18b04a901683c8757a270c322e92ff6ef2b63ee12097374984044b32f81e1cccb96a338
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sidekiq-skylight.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Allen Madsen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Sidekiq::Skylight
2
+
3
+ Middleware for instrumenting Sidekiq with Skylight.io
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sidekiq-skylight'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sidekiq-skylight
20
+
21
+ ## Usage
22
+
23
+ Make sure you've setup skylight.io for your project already. Everything else should be automatic.
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/lintci/sidekiq-skylight/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,10 @@
1
+ require 'sidekiq'
2
+
3
+ require_relative 'skylight/version'
4
+ require_relative 'skylight/server_middleware'
5
+
6
+ Sidekiq.configure_server do |config|
7
+ config.server_middleware do |chain|
8
+ chain.prepend Sidekiq::Skylight::ServerMiddleware
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ require 'skylight'
2
+
3
+ module Sidekiq
4
+ module Skylight
5
+ class ServerMiddleware
6
+ def call(worker, job, queue)
7
+ ::Skylight.instrument(category: 'worker.sidekiq.job', title: 'perform') do
8
+ yield
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Sidekiq
2
+ module Skylight
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sidekiq/skylight/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sidekiq-skylight"
8
+ spec.version = Sidekiq::Skylight::VERSION
9
+ spec.authors = ["Allen Madsen"]
10
+ spec.email = ["blatyo@gmail.com"]
11
+ spec.summary = %q{Middleware for instrumenting Sidekiq with Skylight.io}
12
+ spec.description = %q{Middleware for instrumenting Sidekiq with Skylight.io. Automatically configured when required.}
13
+ spec.homepage = "https://github.com/lintci/sidekiq-skylight"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'sidekiq', '>= 3.3.0'
22
+ spec.add_runtime_dependency 'skylight', '>= 0.5.2'
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sidekiq::Skylight::ServerMiddleware do
4
+ subject(:middleware){described_class.new}
5
+
6
+ it 'wraps block in skylight instrument' do
7
+ expect(::Skylight).to receive(:instrument).with(category: 'worker.sidekiq.job', title: 'perform'){|&block| block.call}
8
+
9
+ expect{|probe| middleware.call(double(:worker), double(:job), double(:queue), &probe)}.to yield_control
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sidekiq::Skylight do
4
+ it 'has a version number' do
5
+ expect(Sidekiq::Skylight::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'adds Skylight as first server middleware' do
9
+ expect(Sidekiq.server_middleware.entries.first.klass).to eq(Sidekiq::Skylight::ServerMiddleware)
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ # Require necessary files for sidekiq to believe it's running in server mode
4
+ require 'celluloid'
5
+ require 'sidekiq/cli'
6
+ require 'sidekiq/launcher'
7
+
8
+ require 'sidekiq/skylight'
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sidekiq-skylight
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Allen Madsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sidekiq
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: skylight
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Middleware for instrumenting Sidekiq with Skylight.io. Automatically
84
+ configured when required.
85
+ email:
86
+ - blatyo@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - lib/sidekiq/skylight.rb
99
+ - lib/sidekiq/skylight/server_middleware.rb
100
+ - lib/sidekiq/skylight/version.rb
101
+ - sidekiq-skylight.gemspec
102
+ - spec/sidekiq/skylight/server_middleware_spec.rb
103
+ - spec/sidekiq/skylight_spec.rb
104
+ - spec/spec_helper.rb
105
+ homepage: https://github.com/lintci/sidekiq-skylight
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.4.5
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Middleware for instrumenting Sidekiq with Skylight.io
129
+ test_files:
130
+ - spec/sidekiq/skylight/server_middleware_spec.rb
131
+ - spec/sidekiq/skylight_spec.rb
132
+ - spec/spec_helper.rb