honeykiq 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29a3d18dbdcd28d505474e7066089b0bbde7b9db3faa0b994fbc0e54fa412dc2
4
- data.tar.gz: b31189efcefaabde05722510097b1ad746c92f542f4e749993c94d775223af9e
3
+ metadata.gz: 0707fda7ab02e35cece97138ce692a99aa4e94b4fdbd29e146f2a12c0e15c2e0
4
+ data.tar.gz: '0686f052a0cb97ea83f4621e079ea610a43ce3e9771f1155cdb36a962c9132e1'
5
5
  SHA512:
6
- metadata.gz: '0495bb5f2d2ba5f2848e4dbe8a58c4d8d97c7c905bca2d33b2692a33ac33ad56ec49ff0368a52f0bbc8265ea971e356a49237bd8aa006efcbc40245110362667'
7
- data.tar.gz: 7c702869ffdcc5bedcad9145c3d9979a63d96fa8540b01140272ee743d5b825839ace3dfe478fc2f2b7762ea31050b69001720f8d4dd790d82e47e44f7031730
6
+ metadata.gz: 071fb39ceafad14abc0f3dd9200cef6c6f1459d4c3f0b389b534ed110bf3c81e89d9800774ad6f06899fe598c89011253d2efccaf385d025ceff4690c36e404d
7
+ data.tar.gz: 001a4165c484889b3eba3755cf98d301c4bd6dc1a1a5274eb85ac05d5cfd49361080cb5ebb0c5723b77afb3d638dfef82d7c49cc940a9cf86c5f26a82016e3ff
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.0]
10
+ ### Added
11
+ - Allow extra_fields to be invoked with job (#16)
12
+
9
13
  ## [1.1.0]
10
14
  ### Added
11
15
  - Honeycomb beeline support (#9)
@@ -33,7 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
37
  ### Removed
34
38
  - `Honeykiq.periodic_reporter`. (Use `Honeykiq::PeriodicReporter.new` instead.)
35
39
 
36
- [Unreleased]: https://github.com/carwow/honeykiq/compare/v1.1.0...HEAD
40
+ [Unreleased]: https://github.com/carwow/honeykiq/compare/v1.2.0...HEAD
41
+ [1.2.0]: https://github.com/carwow/honeykiq/compare/v1.1.0...v1.2.0
37
42
  [1.1.0]: https://github.com/carwow/honeykiq/compare/v1.0.0...v1.1.0
38
43
  [1.0.0]: https://github.com/carwow/honeykiq/compare/v0.3.1...v1.0.0
39
44
  [0.3.1]: https://github.com/carwow/honeykiq/compare/v0.3.0...v0.3.1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- honeykiq (1.1.0)
4
+ honeykiq (1.2.0)
5
5
  sidekiq
6
6
 
7
7
  GEM
@@ -9,21 +9,21 @@ GEM
9
9
  specs:
10
10
  addressable (2.7.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
- ast (2.4.0)
13
- carwow_rubocop (3.2.2)
12
+ ast (2.4.1)
13
+ carwow_rubocop (3.3.0)
14
14
  rubocop (>= 0.78)
15
15
  rubocop-performance
16
16
  rubocop-rspec
17
- coderay (1.1.2)
18
- connection_pool (2.2.2)
19
- diff-lcs (1.3)
17
+ coderay (1.1.3)
18
+ connection_pool (2.2.3)
19
+ diff-lcs (1.4.4)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
- ffi (1.12.2)
22
+ ffi (1.13.1)
23
23
  ffi-compiler (1.0.1)
24
24
  ffi (>= 1.0.0)
25
25
  rake
26
- honeycomb-beeline (2.0.0)
26
+ honeycomb-beeline (2.1.1)
27
27
  libhoney (~> 1.14, >= 1.14.2)
28
28
  http (4.4.1)
29
29
  addressable (~> 2.3)
@@ -35,24 +35,22 @@ GEM
35
35
  http-form_data (2.3.0)
36
36
  http-parser (1.2.1)
37
37
  ffi-compiler (>= 1.0, < 2.0)
38
- jaro_winkler (1.5.4)
39
38
  libhoney (1.14.4)
40
39
  addressable (~> 2.0)
41
40
  http (>= 2.0, < 5.0)
42
41
  method_source (1.0.0)
43
- parallel (1.19.1)
44
- parser (2.7.1.2)
45
- ast (~> 2.4.0)
42
+ parallel (1.19.2)
43
+ parser (2.7.1.4)
44
+ ast (~> 2.4.1)
46
45
  pry (0.13.1)
47
46
  coderay (~> 1.1)
48
47
  method_source (~> 1.0)
49
48
  public_suffix (4.0.5)
50
- rack (2.2.2)
51
- rack-protection (2.0.8.1)
52
- rack
49
+ rack (2.2.3)
53
50
  rainbow (3.0.0)
54
51
  rake (13.0.1)
55
- redis (4.1.4)
52
+ redis (4.2.1)
53
+ regexp_parser (1.7.1)
56
54
  rexml (3.2.4)
57
55
  rspec (3.9.0)
58
56
  rspec-core (~> 3.9.0)
@@ -67,24 +65,26 @@ GEM
67
65
  diff-lcs (>= 1.2.0, < 2.0)
68
66
  rspec-support (~> 3.9.0)
69
67
  rspec-support (3.9.3)
70
- rubocop (0.82.0)
71
- jaro_winkler (~> 1.5.1)
68
+ rubocop (0.88.0)
72
69
  parallel (~> 1.10)
73
- parser (>= 2.7.0.1)
70
+ parser (>= 2.7.1.1)
74
71
  rainbow (>= 2.2.2, < 4.0)
72
+ regexp_parser (>= 1.7)
75
73
  rexml
74
+ rubocop-ast (>= 0.1.0, < 1.0)
76
75
  ruby-progressbar (~> 1.7)
77
76
  unicode-display_width (>= 1.4.0, < 2.0)
78
- rubocop-performance (1.5.2)
79
- rubocop (>= 0.71.0)
80
- rubocop-rspec (1.39.0)
81
- rubocop (>= 0.68.1)
77
+ rubocop-ast (0.2.0)
78
+ parser (>= 2.7.0.1)
79
+ rubocop-performance (1.7.1)
80
+ rubocop (>= 0.82.0)
81
+ rubocop-rspec (1.42.0)
82
+ rubocop (>= 0.87.0)
82
83
  ruby-progressbar (1.10.1)
83
- sidekiq (6.0.7)
84
+ sidekiq (6.1.1)
84
85
  connection_pool (>= 2.2.2)
85
86
  rack (~> 2.0)
86
- rack-protection (>= 2.0.0)
87
- redis (>= 4.1.0)
87
+ redis (>= 4.2.0)
88
88
  unf (0.1.4)
89
89
  unf_ext
90
90
  unf_ext (0.0.7.7)
data/README.md CHANGED
@@ -64,7 +64,7 @@ event:
64
64
 
65
65
  ```ruby
66
66
  class MyServerMiddleware < Honeykiq::ServerMiddleware
67
- def extra_fields
67
+ def extra_fields(job) # Sidekiq::Job instance
68
68
  {
69
69
  my_data: 'evaluated and added to the event after the job has finished/errored',
70
70
  my_function: -> { Time.now }
@@ -117,18 +117,21 @@ module Clockwork
117
117
  end
118
118
  ```
119
119
 
120
+ [clockwork]: https://github.com/Rykian/clockwork
121
+
120
122
  ## Contributing
121
123
 
122
- [Pull requests](https://github.com/carwow/honeykiq/pulls) are very welcome!
123
- Don't forget to add yourself to [CONTRIBUTORS.txt].
124
+ [Pull requests] are very welcome!
125
+
126
+ Please report bugs in a [new issue].
124
127
 
125
- Please report bugs in a [new issue](https://github.com/carwow/honeykiq/issues/new).
128
+ Everyone is expected to follow the [code of conduct].
126
129
 
127
- [CONTRIBUTORS.txt]: https://github.com/carwow/honeykiq/blob/master/CONTRIBUTORS.txt
130
+ [Pull requests]: https://github.com/carwow/honeykiq/pulls
131
+ [new issue]: https://github.com/carwow/honeykiq/issues/new
132
+ [code of conduct]: https://github.com/carwow/honeykiq/tree/master/CODE_OF_CONDUCT.md
128
133
 
129
134
  ## License
130
135
 
131
136
  The gem is available as open source under the terms of the
132
137
  [MIT License](https://opensource.org/licenses/MIT).
133
-
134
- [clockwork]: https://github.com/Rykian/clockwork
@@ -15,7 +15,7 @@ module Honeykiq
15
15
  end
16
16
  end
17
17
 
18
- def extra_fields
18
+ def extra_fields(_job = nil)
19
19
  {}
20
20
  end
21
21
 
@@ -47,7 +47,7 @@ module Honeykiq
47
47
  on_error(event, error)
48
48
  raise
49
49
  ensure
50
- event.add(extra_fields)
50
+ event.add(call_extra_fields(job))
51
51
  end
52
52
 
53
53
  def default_fields(job, queue)
@@ -78,10 +78,10 @@ module Honeykiq
78
78
  end
79
79
 
80
80
  def duration_ms(event)
81
- start_time = Time.now
81
+ start_time = now
82
82
  yield
83
83
  ensure
84
- duration = Time.now - start_time
84
+ duration = now - start_time
85
85
  event.add_field(:duration_ms, duration * 1000)
86
86
  end
87
87
 
@@ -96,5 +96,22 @@ module Honeykiq
96
96
  'error.message': error.message
97
97
  )
98
98
  end
99
+
100
+ def call_extra_fields(job)
101
+ case method(:extra_fields).arity
102
+ when 0 then extra_fields
103
+ else extra_fields(job)
104
+ end
105
+ end
106
+
107
+ if defined?(Process::CLOCK_MONOTONIC)
108
+ def now
109
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
110
+ end
111
+ else
112
+ def now
113
+ Time.now
114
+ end
115
+ end
99
116
  end
100
117
  end
@@ -1,3 +1,3 @@
1
1
  module Honeykiq
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeykiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carwow Developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -121,7 +121,6 @@ files:
121
121
  - ".rubocop.yml"
122
122
  - CHANGELOG.md
123
123
  - CODE_OF_CONDUCT.md
124
- - CONTRIBUTORS.txt
125
124
  - Gemfile
126
125
  - Gemfile.lock
127
126
  - LICENSE.txt
@@ -137,7 +136,7 @@ licenses:
137
136
  - MIT
138
137
  metadata:
139
138
  allowed_push_host: https://rubygems.org
140
- post_install_message:
139
+ post_install_message:
141
140
  rdoc_options: []
142
141
  require_paths:
143
142
  - lib
@@ -153,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
152
  version: '0'
154
153
  requirements: []
155
154
  rubygems_version: 3.1.2
156
- signing_key:
155
+ signing_key:
157
156
  specification_version: 4
158
157
  summary: "Sidekiq → Honeycomb \U0001F41D"
159
158
  test_files: []
@@ -1,3 +0,0 @@
1
- Pedro Chambino <pedro.chambino@carwow.co.uk>
2
- Dan Rees-Jones <dan.reesjones@carwow.co.uk>
3
- Christian Gregg <christian.gregg@carwow.co.uk>