mettric 0.1.13 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mettric/mettric.rb +1 -1
- data/lib/mettric/sidekiq_middleware.rb +20 -9
- data/lib/mettric/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d76dbab9498e309d9cbceef170e6d5f6677f9728
|
4
|
+
data.tar.gz: 9e373a5068b4d00e2e272eba10b9f92d36becfe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 304c43ef459a0160fb4249b61540b449e6bade8bda5626267ca610f3894ff009fa4f6c12b2f151b322a58a4216cef7cab8c50f7f7df7d106c8a01e679666b23f
|
7
|
+
data.tar.gz: ceb560d5c836833300ee731e8590e2a6ac07cc4e5f7b8e722c9baa4bb0f7caf3feae19204e3412197c927bfce22c7d5c68dd5db3c31544de54974e98fedda1cd
|
data/lib/mettric/mettric.rb
CHANGED
@@ -42,8 +42,8 @@ class Mettric
|
|
42
42
|
exception = e
|
43
43
|
state = 'failure'
|
44
44
|
end
|
45
|
-
payload[:service] = "#{payload[:service]} ms" unless payload[:service].to_s.end_with?(' ms')
|
46
45
|
payload[:metric] = ((Time.now - start) * 1000).to_i
|
46
|
+
payload[:description] = [payload[:description], "(ms)"].compact.join(' ')
|
47
47
|
payload[:tags] ||= []
|
48
48
|
payload[:tags] << :timing
|
49
49
|
track(payload)
|
@@ -5,19 +5,30 @@ class Mettric::SidekiqMiddleware
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def call(worker, msg, queue)
|
8
|
-
|
8
|
+
begin
|
9
|
+
opts = worker.class.sidekiq_options['mettric']
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
# Don't do anything if we're told to skip this class
|
12
|
+
if opts != true and opts != nil
|
13
|
+
return yield
|
14
|
+
end
|
15
|
+
|
16
|
+
# Tracking under this name
|
17
|
+
service = "sidekiq.queue:#{queue.to_s.underscore}.worker:#{worker.class.name.underscore}"
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
# Yield & time
|
20
|
+
Mettric.time(service: "#{service}.duration", tags: ['sidekiq']) do
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
rescue
|
24
|
+
Mettric.event(service: "#{service}.error", tags: ['sidekiq'])
|
25
|
+
raise
|
19
26
|
end
|
27
|
+
|
28
|
+
# Track success
|
29
|
+
Mettric.event(service: "#{service}.success", tags: ['sidekiq'])
|
20
30
|
end
|
31
|
+
|
21
32
|
end
|
22
33
|
|
23
34
|
if Kernel.const_defined?(:Sidekiq)
|
data/lib/mettric/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mettric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannis Hermanns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|