loga 2.3.1 → 2.4.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
2
  SHA256:
3
- metadata.gz: 9144c2b13cb8e6ed178d6ee24e99c9d00d4ce23bf3198d487e1803d221038874
4
- data.tar.gz: 2528a6ce89a60dccc50e22f98abd1e4e74ae3f49319adeed42a89a98ad4412f8
3
+ metadata.gz: 8b069a9b029cfb82d0a179ebb76738b71506eb717c49e0053c135204225f7d4f
4
+ data.tar.gz: e62a39b1e52025dc1bcd7a8c69b1d8e260f73e954de16f7c9fbfb42529154363
5
5
  SHA512:
6
- metadata.gz: 1d9b346f49a5661ab32f3cabe4a16edba7757aa5a5d10b830758d1ca12ff70ece723014701a5ba82da7d358736c320af4a91e7dee609ba657d200905b5afdb3f
7
- data.tar.gz: e53c366b5efcb67136322cae79fa6f21fcfdbefd654cb982681067b02de0c86d02f678afe02b7e5c3db298024818ba06dd5ac4ad51f0c234ea799a906295782d
6
+ metadata.gz: 9aae956e2b49cc519590cca3be9d32d6d268871b4d8bc97fb568b66003d3fd7913f04debf445b6cee2ced3a04d1d3af610eb256c48411b3f92fc76b3120c8d51
7
+ data.tar.gz: 16f42b6af8af4479ae5dfec57f47c27db4b41d9e4b7e58491e289cb5d487316d115fe47723bbf8690c30d692da59bb134a29f2b9eb964b9ff7477a3a5b2fd1f0
@@ -58,21 +58,21 @@ jobs:
58
58
  command: |
59
59
  ./tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -o tmp/codeclimate.total.json
60
60
  ./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json -r $CODECLIMATE_REPO_TOKEN
61
- ruby-2.2:
62
- docker:
63
- - image: circleci/ruby:2.2.10
64
- <<: *test_build
65
61
  ruby-2.3:
66
62
  docker:
67
- - image: circleci/ruby:2.3.7
63
+ - image: circleci/ruby:2.3
68
64
  <<: *test_build
69
65
  ruby-2.4:
70
66
  docker:
71
- - image: circleci/ruby:2.4.4
67
+ - image: circleci/ruby:2.4
72
68
  <<: *test_build
73
69
  ruby-2.5:
74
70
  docker:
75
- - image: circleci/ruby:2.5.1
71
+ - image: circleci/ruby:2.5
72
+ <<: *test_build
73
+ ruby-2.6:
74
+ docker:
75
+ - image: circleci/ruby:2.6
76
76
  <<: *test_build
77
77
  rubocop:
78
78
  <<: *basic_build
@@ -111,25 +111,25 @@ workflows:
111
111
  filters:
112
112
  tags:
113
113
  only: /.*/
114
- - ruby-2.2:
114
+ - ruby-2.3:
115
115
  filters:
116
116
  tags:
117
117
  only: /.*/
118
118
  requires:
119
119
  - build
120
- - ruby-2.3:
120
+ - ruby-2.4:
121
121
  filters:
122
122
  tags:
123
123
  only: /.*/
124
124
  requires:
125
125
  - build
126
- - ruby-2.4:
126
+ - ruby-2.5:
127
127
  filters:
128
128
  tags:
129
129
  only: /.*/
130
130
  requires:
131
131
  - build
132
- - ruby-2.5:
132
+ - ruby-2.6:
133
133
  filters:
134
134
  tags:
135
135
  only: /.*/
@@ -140,10 +140,10 @@ workflows:
140
140
  tags:
141
141
  only: /.*/
142
142
  requires:
143
- - ruby-2.2
144
143
  - ruby-2.3
145
144
  - ruby-2.4
146
145
  - ruby-2.5
146
+ - ruby-2.6
147
147
  - push-to-rubygems:
148
148
  filters:
149
149
  tags:
@@ -152,7 +152,7 @@ workflows:
152
152
  ignore: /.*/
153
153
  requires:
154
154
  - rubocop
155
- - ruby-2.2
156
155
  - ruby-2.3
157
156
  - ruby-2.4
158
157
  - ruby-2.5
158
+ - ruby-2.6
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [2.4.0] - 2019-09-03
8
+ ### Fixed
9
+ - `duration` in the `sidekiq` integration is now calculated correctly
10
+ ### Added
11
+ - Add build for ruby 2.6
12
+ ### Removed
13
+ - Remove build for ruby 2.2
14
+
7
15
  ## [2.3.1] - 2019-05-14
8
16
  ### Added
9
17
  New configuration option `hide_pii` which defaults to `true` to hide email addresses in logs that get generate when an email is sent through action_mailer
@@ -9,14 +9,16 @@ module Loga
9
9
 
10
10
  EVENT_TYPE = 'sidekiq'.freeze
11
11
 
12
- attr_reader :started_at, :data
12
+ def started_at
13
+ @started_at ||= Time.now
14
+ end
13
15
 
14
- def initialize
15
- @started_at = Time.now
16
- @data = {}
16
+ def data
17
+ @data ||= {}
17
18
  end
18
19
 
19
20
  def call(item, _queue)
21
+ reset_data
20
22
  yield
21
23
  rescue Exception => ex # rubocop:disable Lint/RescueException
22
24
  data['exception'] = ex
@@ -29,6 +31,11 @@ module Loga
29
31
 
30
32
  private
31
33
 
34
+ def reset_data
35
+ @data = {}
36
+ @started_at = Time.now
37
+ end
38
+
32
39
  def assign_data(item)
33
40
  data['created_at'] = item['created_at']
34
41
  data['enqueued_at'] = item['enqueued_at']
@@ -1,3 +1,3 @@
1
1
  module Loga
2
- VERSION = '2.3.1'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
@@ -21,9 +21,9 @@ end
21
21
  describe 'Sidekiq client logger' do
22
22
  let(:target) { StringIO.new }
23
23
 
24
- let(:json_line) do
24
+ def read_json_log(line:)
25
25
  target.rewind
26
- JSON.parse(target.read)
26
+ JSON.parse(target.each_line.drop(line - 1).first)
27
27
  end
28
28
 
29
29
  before do
@@ -117,6 +117,8 @@ describe 'Sidekiq client logger' do
117
117
  'version'=> '1.1',
118
118
  }
119
119
 
120
+ json_line = read_json_log(line: 1)
121
+
120
122
  aggregate_failures do
121
123
  expect(json_line).to include(expected_attributes)
122
124
 
@@ -126,6 +128,20 @@ describe 'Sidekiq client logger' do
126
128
 
127
129
  expect(json_line['short_message']).to match(/MySidekiqWorker with jid:*/)
128
130
  end
131
+
132
+ # This was a bug - the duration was constantly incresing based on when
133
+ # the logger was created. https://github.com/FundingCircle/loga/pull/117
134
+ #
135
+ # Test that after sleeping for few seconds the duration is still under 500ms
136
+ sleep 1
137
+
138
+ MySidekiqWorker.perform_async('Bob')
139
+
140
+ sleep 1
141
+
142
+ json_line = read_json_log(line: 2)
143
+
144
+ expect(json_line['_duration']).to be < 500
129
145
  end
130
146
  end
131
147
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loga
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Funding Circle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-14 00:00:00.000000000 Z
11
+ date: 2019-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport