pliny-sidekiq 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -2
- data/CHANGELOG.md +4 -2
- data/lib/pliny/sidekiq.rb +1 -0
- data/lib/pliny/sidekiq/job_logger.rb +32 -0
- data/lib/pliny/sidekiq/version.rb +1 -1
- data/pliny-sidekiq.gemspec +2 -3
- metadata +12 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b818bcbd0a4b55b67e74434671872590dafa61de44592da5e512ddc56fcf3596
|
4
|
+
data.tar.gz: f6bccd7f8c6e0151354f182114ee0c3c5ddfed7518c2ee1fc827aa9ce6831b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a50d5f3cbd76d75831eef3fb50445c3927545a58296cffd1d3eb00616e7474ce1f894a2179235f921509722357bc75859b5b35f077669cec001cf5f3941d1167
|
7
|
+
data.tar.gz: 2f21ab0defc7c914e1f70545f60fae262ab22a7e91df4eb818344d181c821623ae770fc33b2b35597850cb180e73cbe2850b2d9c1bd8625d8e35487f8f14a4cc
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
The format is based on [Keep a Changelog](
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [0.3.0]
|
8
|
+
### Added
|
9
|
+
Pliny::Sidekiq::JobLogger to use as Sidekiq job logger `config.options[:job_logger]`
|
8
10
|
|
9
11
|
## 0.2.2
|
10
12
|
|
data/lib/pliny/sidekiq.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Pliny::Sidekiq
|
2
|
+
class JobLogger
|
3
|
+
def call(job, queue)
|
4
|
+
context = {
|
5
|
+
sidekiq: true,
|
6
|
+
job: job['class'],
|
7
|
+
job_jid: job['jid'],
|
8
|
+
job_retry: job['retry'],
|
9
|
+
}
|
10
|
+
|
11
|
+
begin
|
12
|
+
start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
13
|
+
log(context, job_logger: true, at: :start)
|
14
|
+
yield
|
15
|
+
log(context, job_logger: true, at: :finish, status: :done, duration: elapsed(start))
|
16
|
+
rescue Exception
|
17
|
+
log(context, job_logger: true, at: :finish, status: :fail, duration: elapsed(start))
|
18
|
+
raise
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def log(context, data = {}, &blk)
|
25
|
+
Pliny.log(context.merge(data), &blk)
|
26
|
+
end
|
27
|
+
|
28
|
+
def elapsed(start)
|
29
|
+
(::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start).round(3)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/pliny-sidekiq.gemspec
CHANGED
@@ -20,9 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "pliny", ">= 0.18.0"
|
21
21
|
spec.add_dependency "sidekiq"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
24
23
|
spec.add_development_dependency "pry"
|
25
24
|
spec.add_development_dependency "pry-byebug"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec"
|
28
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pliny-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guðmundur Bjarni Ólafsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pliny
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
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.10'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.10'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: pry
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,30 +70,30 @@ dependencies:
|
|
84
70
|
name: rake
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- - "
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- - "
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: rspec
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
89
|
+
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
96
|
+
version: '0'
|
111
97
|
description: Pliny logging and request_id support for Sidekiq
|
112
98
|
email:
|
113
99
|
- gudmundur.bjarni@gmail.com
|
@@ -125,6 +111,7 @@ files:
|
|
125
111
|
- bin/console
|
126
112
|
- bin/setup
|
127
113
|
- lib/pliny/sidekiq.rb
|
114
|
+
- lib/pliny/sidekiq/job_logger.rb
|
128
115
|
- lib/pliny/sidekiq/middleware/client/log.rb
|
129
116
|
- lib/pliny/sidekiq/middleware/client/request_id.rb
|
130
117
|
- lib/pliny/sidekiq/middleware/server/log.rb
|
@@ -150,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
137
|
- !ruby/object:Gem::Version
|
151
138
|
version: '0'
|
152
139
|
requirements: []
|
153
|
-
|
154
|
-
rubygems_version: 2.5.1
|
140
|
+
rubygems_version: 3.0.3
|
155
141
|
signing_key:
|
156
142
|
specification_version: 4
|
157
143
|
summary: Pliny logging and request_id support for Sidekiq
|