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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ffd31216e045967faface4ea6b144e15cf5cd453
4
- data.tar.gz: f70891cd6f67825353ed9b6f0db7eedbaa566fab
2
+ SHA256:
3
+ metadata.gz: b818bcbd0a4b55b67e74434671872590dafa61de44592da5e512ddc56fcf3596
4
+ data.tar.gz: f6bccd7f8c6e0151354f182114ee0c3c5ddfed7518c2ee1fc827aa9ce6831b58
5
5
  SHA512:
6
- metadata.gz: 0c631a89fcd719da073e331e8204370930a041a5fed3ffbee2b9fefeb952e80fd4bd5ab1d29e448458f20d07aed01adf79204c1be8da38990eda25c1011dd80b
7
- data.tar.gz: d188007d0604b4c23d462335e02f7c8268c86890812dd68d033414c813583b3ea93e80792dc2db0d8e0387dc2d80aa4a667350c94f7a4b898cd7dc7ba8f870a9
6
+ metadata.gz: a50d5f3cbd76d75831eef3fb50445c3927545a58296cffd1d3eb00616e7474ce1f894a2179235f921509722357bc75859b5b35f077669cec001cf5f3941d1167
7
+ data.tar.gz: 2f21ab0defc7c914e1f70545f60fae262ab22a7e91df4eb818344d181c821623ae770fc33b2b35597850cb180e73cbe2850b2d9c1bd8625d8e35487f8f14a4cc
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6
3
+ - 2.6.3
4
+ - 2.5.5
5
+ - 2.4.6
6
+ before_install: gem install bundler
@@ -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](http://keepachangelog.com/)
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
- ## [Unreleased]
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
 
@@ -1,4 +1,5 @@
1
1
  require "pliny/sidekiq/version"
2
+ require "pliny/sidekiq/job_logger"
2
3
  require "pliny/sidekiq/middleware/client/log"
3
4
  require "pliny/sidekiq/middleware/client/request_id"
4
5
  require "pliny/sidekiq/middleware/server/log"
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Pliny
2
2
  module Sidekiq
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -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", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.3"
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.2.2
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: 2016-12-08 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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: '3.3'
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: '3.3'
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
- rubyforge_project:
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