mettric 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mettric/sidekiq_middleware.rb +9 -9
- data/lib/mettric/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3877f9991bb5a46bc0c08dfad54d3d594fb9e71c
|
4
|
+
data.tar.gz: c1ab8114b49b654a92cf7f50d26ee7725fb87def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2c5326d53df56739322356765f247dd94ca383275801625229776f376c3d8bc1357d6961d23a093badd68b0a23a42de6887f4a7cf9d6bdbce1b4838b1f0d9dc
|
7
|
+
data.tar.gz: cfada3ac03e3e1afbc3c9f3db212b2358ce53c26556c9d12c14ffd921f4191286c4334b7a7d56b5bbdba2e69936d7f7fea862db46570b33a6c4ee7ce07bba37e
|
@@ -1,21 +1,21 @@
|
|
1
1
|
require 'active_support/inflector'
|
2
2
|
|
3
3
|
class Mettric::SidekiqMiddleware
|
4
|
-
def initialize(_options)
|
4
|
+
def initialize(_options = {})
|
5
5
|
end
|
6
6
|
|
7
7
|
def call(worker, msg, queue)
|
8
|
+
opts = worker.class.sidekiq_options['mettric']
|
9
|
+
|
10
|
+
# Don't do anything if we're told to skip this class
|
11
|
+
if opts != true
|
12
|
+
return yield
|
13
|
+
end
|
14
|
+
|
15
|
+
# Track the job timing
|
8
16
|
service = "sidekiq.queue.#{queue}.workers.#{worker.class.name.underscore}",
|
9
17
|
Mettric.time(service: service, tags: ['sidekiq']) do
|
10
18
|
yield
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
14
|
-
|
15
|
-
if Kernel.const_defined?(:Sidekiq)
|
16
|
-
Sidekiq.configure_server do |config|
|
17
|
-
config.server_middleware do |chain|
|
18
|
-
chain.add Mettric::SidekiqMiddleware
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/mettric/version.rb
CHANGED