juan_pelota 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.txt +19 -0
- data/Rakefile +2 -0
- data/lib/juan_pelota/configuration.rb +5 -3
- data/lib/juan_pelota/logger.rb +23 -18
- data/lib/juan_pelota/middlewares/logging.rb +15 -14
- data/lib/juan_pelota/version.rb +3 -1
- data/lib/juan_pelota.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +44 -20
- metadata.gz.sig +0 -0
- data/LICENSE +0 -22
- data/spec/juan_pelota/logger_spec.rb +0 -157
- data/spec/spec_helper.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d3ad11775f22c6779a0181bb3ebdac39f23b15fc1d929eddb704d39d4eac137
|
4
|
+
data.tar.gz: dffa44eda6417af4e0ac1c8ca2cf812d3491cb4a3ee9425f20487ee39e81721d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e958cf459d7de7e468ff595b805364b3ea7444bad7c69e6c473665873e54632958bfff2bc70c9f6a0297ab2762fc84c192d8cf9cdc27e246a9c45aa4541a73c
|
7
|
+
data.tar.gz: b66950aac6dceefa71bd1cb0ee70812aa3fabd3ace60af47d6121dd3474758608ef8e4e48ba219c4b1368ee92709f01fa330861dbbf1de83379f8c94e42fb710
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2010-2016 The Kompanee, Ltd
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
4
|
|
3
5
|
module JuanPelota
|
@@ -5,15 +7,15 @@ module JuanPelota
|
|
5
7
|
if block_given?
|
6
8
|
yield Configuration.instance
|
7
9
|
else
|
8
|
-
|
10
|
+
Configuration.instance
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
class Configuration
|
13
15
|
include Singleton
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
attr_writer :filtered_arguments,
|
18
|
+
:filtered_workers
|
17
19
|
|
18
20
|
def filtered_arguments
|
19
21
|
@filtered_arguments || []
|
data/lib/juan_pelota/logger.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sidekiq/logger'
|
1
4
|
require 'juan_pelota/version'
|
2
5
|
require 'juan_pelota'
|
3
6
|
require 'json'
|
4
7
|
|
5
8
|
module JuanPelota
|
6
|
-
class Logger < Sidekiq::
|
9
|
+
class Logger < ::Sidekiq::Logger::Formatters::Base
|
7
10
|
IGNORABLE_STATUSES = %w{start done queueing}.freeze
|
8
11
|
|
9
12
|
attr_accessor :severity,
|
10
13
|
:timestamp,
|
11
|
-
:program_name
|
12
|
-
|
14
|
+
:program_name
|
15
|
+
attr_writer :raw_message
|
13
16
|
|
14
|
-
def call(severity, time, program_name, incoming_message)
|
17
|
+
def call(severity, time, program_name, incoming_message) # rubocop:disable Metrics/AbcSize
|
15
18
|
self.severity = severity
|
16
19
|
self.timestamp = time.utc.iso8601
|
17
20
|
self.program_name = program_name
|
@@ -20,7 +23,7 @@ class Logger < Sidekiq::Logging::Pretty
|
|
20
23
|
return if config.filtered_workers.include?(worker_name.to_s) &&
|
21
24
|
IGNORABLE_STATUSES.include?(status)
|
22
25
|
|
23
|
-
{
|
26
|
+
{ # rubocop:disable Style/StringConcatenation
|
24
27
|
'@type' => 'sidekiq',
|
25
28
|
'@timestamp' => timestamp,
|
26
29
|
'@status' => status,
|
@@ -30,7 +33,7 @@ class Logger < Sidekiq::Logging::Pretty
|
|
30
33
|
'@fields' => {
|
31
34
|
pid: self.class.pid,
|
32
35
|
tid: self.class.tid,
|
33
|
-
context:
|
36
|
+
context: ctx,
|
34
37
|
program_name: program_name,
|
35
38
|
worker: worker_name,
|
36
39
|
arguments: arguments,
|
@@ -38,26 +41,36 @@ class Logger < Sidekiq::Logging::Pretty
|
|
38
41
|
}.to_json + "\n"
|
39
42
|
end
|
40
43
|
|
44
|
+
def self.pid
|
45
|
+
::Process.pid
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.tid
|
49
|
+
::Thread.current.object_id.to_s(36)
|
50
|
+
end
|
51
|
+
|
41
52
|
private
|
42
53
|
|
43
|
-
def raw_message
|
54
|
+
def raw_message # rubocop:disable Metrics/CyclomaticComplexity
|
44
55
|
if @raw_message.is_a? Hash
|
45
56
|
@raw_message
|
46
57
|
elsif @raw_message.respond_to?(:match) &&
|
47
58
|
@raw_message.match(/^queueing/)
|
59
|
+
|
48
60
|
{
|
49
61
|
'status' => 'queueing',
|
50
62
|
'message' => @raw_message,
|
51
|
-
'class' => @raw_message.split
|
63
|
+
'class' => @raw_message.split[1],
|
52
64
|
}
|
53
65
|
elsif @raw_message.respond_to?(:match) &&
|
54
66
|
@raw_message.match(/:\d+:in\s`/)
|
67
|
+
|
55
68
|
{
|
56
|
-
'message' => @raw_message.lines.first(10).map(&:chomp)
|
69
|
+
'message' => @raw_message.lines.first(10).map!(&:chomp),
|
57
70
|
}
|
58
71
|
else
|
59
72
|
{
|
60
|
-
'message' => @raw_message
|
73
|
+
'message' => @raw_message,
|
61
74
|
}
|
62
75
|
end
|
63
76
|
end
|
@@ -90,14 +103,6 @@ class Logger < Sidekiq::Logging::Pretty
|
|
90
103
|
raw_message['class']
|
91
104
|
end
|
92
105
|
|
93
|
-
def self.pid
|
94
|
-
::Process.pid
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.tid
|
98
|
-
::Thread.current.object_id.to_s(36)
|
99
|
-
end
|
100
|
-
|
101
106
|
def config
|
102
107
|
Configuration.instance
|
103
108
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module JuanPelota
|
2
4
|
module Middlewares
|
3
5
|
class Logging
|
4
|
-
# rubocop:disable Lint/RescueException, Metrics/AbcSize
|
6
|
+
# rubocop:disable Lint/RescueException, Metrics/AbcSize
|
5
7
|
def call(worker, job, _queue)
|
6
8
|
start = Time.now
|
7
9
|
|
@@ -28,11 +30,11 @@ class Logging
|
|
28
30
|
'args' => filtered_arguments(job['args'].try(:first)),
|
29
31
|
)
|
30
32
|
end
|
31
|
-
rescue Exception =>
|
33
|
+
rescue Exception => error
|
32
34
|
message = {
|
33
|
-
'error_class' =>
|
34
|
-
'error_message' =>
|
35
|
-
'error_backtrace' =>
|
35
|
+
'error_class' => error.class.name,
|
36
|
+
'error_message' => error.message,
|
37
|
+
'error_backtrace' => error.backtrace.first(10),
|
36
38
|
}
|
37
39
|
|
38
40
|
logger.info(
|
@@ -45,27 +47,26 @@ class Logging
|
|
45
47
|
'args' => filtered_arguments(job['args'].try(:first)),
|
46
48
|
)
|
47
49
|
|
48
|
-
raise
|
50
|
+
raise error
|
49
51
|
end
|
50
|
-
# rubocop:enable Lint/RescueException, Metrics/AbcSize
|
52
|
+
# rubocop:enable Lint/RescueException, Metrics/AbcSize
|
51
53
|
|
52
54
|
def elapsed(start)
|
53
|
-
(Time.now - start).
|
55
|
+
Float((Time.now - start)).round(3)
|
54
56
|
end
|
55
57
|
|
56
58
|
def logger
|
57
|
-
Sidekiq.logger
|
59
|
+
::Sidekiq.logger
|
58
60
|
end
|
59
61
|
|
60
62
|
def filtered_arguments(args)
|
61
63
|
return if args.nil?
|
62
64
|
|
63
|
-
@filtered_arguments ||=
|
64
|
-
|
65
|
-
value = filtered_arguments(value) if value.is_a? Hash
|
65
|
+
@filtered_arguments ||= args.each_with_object({}) do |(key, value), filtered_hash|
|
66
|
+
value = filtered_arguments(value) if value.is_a? Hash
|
66
67
|
|
67
|
-
|
68
|
-
|
68
|
+
filtered_hash[key] = value unless config.filtered_arguments.include? key
|
69
|
+
end
|
69
70
|
end
|
70
71
|
|
71
72
|
private
|
data/lib/juan_pelota/version.rb
CHANGED
data/lib/juan_pelota.rb
CHANGED
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juan_pelota
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekompanee
|
8
|
-
- goodscout
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIErjCCAxagAwIBAgIBATANBgkqhkiG9w0BAQsFADBOMRowGAYDVQQDDBFhY2Nv
|
14
|
+
dW50c19ydWJ5Z2VtczEbMBkGCgmSJomT8ixkARkWC3RoZWtvbXBhbmVlMRMwEQYK
|
15
|
+
CZImiZPyLGQBGRYDY29tMB4XDTIyMDMwNDE5NTc0NloXDTIzMDMwNDE5NTc0Nlow
|
16
|
+
TjEaMBgGA1UEAwwRYWNjb3VudHNfcnVieWdlbXMxGzAZBgoJkiaJk/IsZAEZFgt0
|
17
|
+
aGVrb21wYW5lZTETMBEGCgmSJomT8ixkARkWA2NvbTCCAaIwDQYJKoZIhvcNAQEB
|
18
|
+
BQADggGPADCCAYoCggGBAPRnzg/G0TSKJYIxNBueK3oPjDnkYYFBmeGlZQInALRK
|
19
|
+
lD+OdPQWyZqDygAh0NyUu8sL2POpICaQ66OWmQkxvk1puCSEoXAeLpxVb+DP9xWc
|
20
|
+
hIC/wtBMgzlzXDKHBf9iFUVo1g3MyLMH/+Rk55ee/rHS2pX01ju6sdxPqYLDIt40
|
21
|
+
kiB/jiLVS36Yq1fETJc1t9ZAtVj3ltWhWDcY4KTJx6tk3g6HfNIkzWz5xlEEWWDs
|
22
|
+
ZHUATdeqzqRGETvKny596CELdtvGCdCuSTxbwWSSXT/7YkAQ2l0Tg5R6kLp0XMOU
|
23
|
+
tndS9KTtUd80FEpK47XmSk+jYbnk3QcvLxptTNu7lyqOFJsiT2HMPoCZ0YJPgOqW
|
24
|
+
x0cjmA6sY/QE7pXEalG5ERMqhnh6k8KxcLZcDCTdMleS66piSB1y/xlHis9bYKI+
|
25
|
+
9GqAbVhXBaNKsjLkO392Uy/F0gyJOPrK0BA/WR90o8VaslMgDa2ymX940H4uJixV
|
26
|
+
2Px3RRT8pNjLuOooyk4TVQIDAQABo4GWMIGTMAkGA1UdEwQCMAAwCwYDVR0PBAQD
|
27
|
+
AgSwMB0GA1UdDgQWBBTv5dC43TjZ9ka/MuFhsjAN+zFlXzAsBgNVHREEJTAjgSFh
|
28
|
+
Y2NvdW50cytydWJ5Z2Vtc0B0aGVrb21wYW5lZS5jb20wLAYDVR0SBCUwI4EhYWNj
|
29
|
+
b3VudHMrcnVieWdlbXNAdGhla29tcGFuZWUuY29tMA0GCSqGSIb3DQEBCwUAA4IB
|
30
|
+
gQA77FB5l21dFSHGwXCHHcvxoNuYl+EC7vgRxBs4jE6Fgn3V5r/eBtQ8XYJ2k2oQ
|
31
|
+
27y98cEozAWH5wjnZTldEABOkhADgYk5gB/ixcs6D+2fM5J8RblrHyyhVydvFCcj
|
32
|
+
5jhG5vYRMlIsTPtjUNueBvXxyyIjysZs5l6YareXJ8Tc9Bliq2ZYlohuMDaw6yqM
|
33
|
+
FrlB+BmbMxMn7agg0s9gh/dAfvZLjveUxeIGzNh8HRb1LJJBBGF9E9KXRhQEEVoN
|
34
|
+
2Q1jYQMxADb6ruQiM9VYIVIfwTrOsF8t9IuoN+xCOUafDQ3Ix3i70BSdzm48toNl
|
35
|
+
0xoB7J4x0kJYk4zrQ9VsLK7xadlR0MC4rfkjPucz41+zOEzoG0hZgoySbR/0K1vX
|
36
|
+
dqKIiQ90U6ghhzc0WhL3K7L50FKfHh1vCXBToYuQIpyWyZtvkTvvDE9vLHmVJH4U
|
37
|
+
wNduo7tKzoOUaVNBOaIdXeZ610yzBamfSN2xNtSord+Y3JTt/Uvn2UmG8QwHqnxq
|
38
|
+
W/M=
|
39
|
+
-----END CERTIFICATE-----
|
40
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
13
41
|
dependencies:
|
14
42
|
- !ruby/object:Gem::Dependency
|
15
43
|
name: sidekiq
|
@@ -17,14 +45,14 @@ dependencies:
|
|
17
45
|
requirements:
|
18
46
|
- - "~>"
|
19
47
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
48
|
+
version: '6.0'
|
21
49
|
type: :runtime
|
22
50
|
prerelease: false
|
23
51
|
version_requirements: !ruby/object:Gem::Requirement
|
24
52
|
requirements:
|
25
53
|
- - "~>"
|
26
54
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
55
|
+
version: '6.0'
|
28
56
|
- !ruby/object:Gem::Dependency
|
29
57
|
name: rspec
|
30
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,21 +101,22 @@ dependencies:
|
|
73
101
|
requirements:
|
74
102
|
- - "~>"
|
75
103
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
104
|
+
version: 0.9.4
|
77
105
|
type: :development
|
78
106
|
prerelease: false
|
79
107
|
version_requirements: !ruby/object:Gem::Requirement
|
80
108
|
requirements:
|
81
109
|
- - "~>"
|
82
110
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
111
|
+
version: 0.9.4
|
84
112
|
description: ''
|
85
|
-
email:
|
113
|
+
email:
|
114
|
+
- info@thekompanee.com
|
86
115
|
executables: []
|
87
116
|
extensions: []
|
88
117
|
extra_rdoc_files: []
|
89
118
|
files:
|
90
|
-
- LICENSE
|
119
|
+
- LICENSE.txt
|
91
120
|
- README.md
|
92
121
|
- Rakefile
|
93
122
|
- lib/juan_pelota.rb
|
@@ -95,12 +124,11 @@ files:
|
|
95
124
|
- lib/juan_pelota/logger.rb
|
96
125
|
- lib/juan_pelota/middlewares/logging.rb
|
97
126
|
- lib/juan_pelota/version.rb
|
98
|
-
|
99
|
-
- spec/spec_helper.rb
|
100
|
-
homepage: https://github.com/goodscout/juan_pelota
|
127
|
+
homepage: https://github.com/thekompanee/juan_pelota
|
101
128
|
licenses:
|
102
129
|
- MIT
|
103
|
-
metadata:
|
130
|
+
metadata:
|
131
|
+
allowed_push_host: https://rubygems.org
|
104
132
|
post_install_message:
|
105
133
|
rdoc_options: []
|
106
134
|
require_paths:
|
@@ -116,12 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
144
|
- !ruby/object:Gem::Version
|
117
145
|
version: '0'
|
118
146
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.4.5.1
|
147
|
+
rubygems_version: 3.1.6
|
121
148
|
signing_key:
|
122
149
|
specification_version: 4
|
123
150
|
summary: Log Sidekiq messages in JSON format
|
124
|
-
test_files:
|
125
|
-
- spec/juan_pelota/logger_spec.rb
|
126
|
-
- spec/spec_helper.rb
|
127
|
-
has_rdoc:
|
151
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Jeff Felchner
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,157 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module JuanPelota
|
4
|
-
describe Logger do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
Configuration.instance.filtered_workers = 'my_filtered_worker'
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'takes message as a hash and logs what we want', :time_mock do
|
11
|
-
json = JuanPelota::Logger.new.call('high',
|
12
|
-
Time.now.utc,
|
13
|
-
'our tests',
|
14
|
-
'args' => 'my_args',
|
15
|
-
'class' => 'my_worker',
|
16
|
-
'run_time' => 100,
|
17
|
-
'message' => 'my message',
|
18
|
-
'status' => 'my_status')
|
19
|
-
|
20
|
-
json_data = JSON.parse(json)
|
21
|
-
|
22
|
-
expect(json_data).to include(
|
23
|
-
'@type' => 'sidekiq',
|
24
|
-
'@timestamp' => '2012-07-26T18:00:00Z',
|
25
|
-
'@status' => 'my_status',
|
26
|
-
'@severity' => 'high',
|
27
|
-
'@run_time' => 100,
|
28
|
-
'@message' => 'my message',
|
29
|
-
'@fields' => include(
|
30
|
-
'pid' => be_a(Integer),
|
31
|
-
'tid' => match(/[a-z0-9]+/),
|
32
|
-
'context' => nil,
|
33
|
-
'program_name' => 'our tests',
|
34
|
-
'worker' => 'my_worker',
|
35
|
-
'arguments' => 'my_args',
|
36
|
-
),
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'take message as a string and picks up if its a worker that is being queued',
|
41
|
-
:time_mock do
|
42
|
-
|
43
|
-
json = JuanPelota::Logger.new.call('high',
|
44
|
-
Time.now.utc,
|
45
|
-
'our tests',
|
46
|
-
'queueing MyWorkerClass')
|
47
|
-
|
48
|
-
json_data = JSON.parse(json)
|
49
|
-
|
50
|
-
expect(json_data).to include(
|
51
|
-
'@status' => 'queueing',
|
52
|
-
'@message' => 'queueing MyWorkerClass',
|
53
|
-
'@fields' => include(
|
54
|
-
'worker' => 'MyWorkerClass',
|
55
|
-
),
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
# rubocop:disable Metrics/LineLength
|
60
|
-
it 'take message as a string and can detect if its a backtrace',
|
61
|
-
:time_mock do
|
62
|
-
|
63
|
-
backtrace = <<-HEREDOC
|
64
|
-
/Users/hhd418/Projects/goodscout/good_products/app/workers/good_products/workers/process_item.rb:50:in `perform'
|
65
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:75:in `execute_job'
|
66
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
|
67
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
|
68
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/plugins/sidekiq.rb:11:in `block in call'
|
69
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/trace.rb:62:in `instrument'
|
70
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/trace.rb:18:in `instrument'
|
71
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/plugins/sidekiq.rb:10:in `call'
|
72
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
73
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-unique-jobs-3.0.14/lib/sidekiq_unique_jobs/middleware/server/unique_jobs.rb:16:in `call'
|
74
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
75
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
|
76
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
77
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
|
78
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
79
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-failures-0.4.4/lib/sidekiq/failures/middleware.rb:9:in `call'
|
80
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
81
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
|
82
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-skylight-0.0.4/lib/sidekiq/skylight/server_middleware.rb:8:in `block in call'
|
83
|
-
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/skylight-0.6.0/lib/skylight/core.rb:70:in `trace'
|
84
|
-
HEREDOC
|
85
|
-
|
86
|
-
json = JuanPelota::Logger.new.call('high',
|
87
|
-
Time.now.utc,
|
88
|
-
'our tests',
|
89
|
-
backtrace)
|
90
|
-
|
91
|
-
json_data = JSON.parse(json)
|
92
|
-
|
93
|
-
expect(json_data).to include(
|
94
|
-
'@status' => 'dead',
|
95
|
-
'@message' => [
|
96
|
-
"/Users/hhd418/Projects/goodscout/good_products/app/workers/good_products/workers/process_item.rb:50:in `perform'",
|
97
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:75:in `execute_job'",
|
98
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'",
|
99
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'",
|
100
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/plugins/sidekiq.rb:11:in `block in call'",
|
101
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/trace.rb:62:in `instrument'",
|
102
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/trace.rb:18:in `instrument'",
|
103
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/honeybadger-2.0.11/lib/honeybadger/plugins/sidekiq.rb:10:in `call'",
|
104
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'",
|
105
|
-
"/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sidekiq-unique-jobs-3.0.14/lib/sidekiq_unique_jobs/middleware/server/unique_jobs.rb:16:in `call'",
|
106
|
-
],
|
107
|
-
)
|
108
|
-
end
|
109
|
-
# rubocop:enable Metrics/LineLength
|
110
|
-
|
111
|
-
it 'set the status to dead and returns a nil worker if it gets a string without ' \
|
112
|
-
'"queueing" in the message',
|
113
|
-
:time_mock do
|
114
|
-
|
115
|
-
json = JuanPelota::Logger.new.call('high',
|
116
|
-
Time.now.utc,
|
117
|
-
'our tests',
|
118
|
-
'My Message')
|
119
|
-
|
120
|
-
json_data = JSON.parse(json)
|
121
|
-
|
122
|
-
expect(json_data).to include(
|
123
|
-
'@status' => 'dead',
|
124
|
-
'@message' => 'My Message',
|
125
|
-
'@fields' => include(
|
126
|
-
'worker' => nil,
|
127
|
-
),
|
128
|
-
)
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'set the status to "Exception" if the message is one', :time_mock do
|
132
|
-
json = JuanPelota::Logger.new.call('high',
|
133
|
-
Time.now.utc,
|
134
|
-
'our tests',
|
135
|
-
Exception.new)
|
136
|
-
|
137
|
-
json_data = JSON.parse(json)
|
138
|
-
|
139
|
-
expect(json_data).to include(
|
140
|
-
'@status' => 'exception',
|
141
|
-
)
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'sets the status to retry if retry is passed in as key to the message', :time_mock do
|
145
|
-
json = JuanPelota::Logger.new.call('high',
|
146
|
-
Time.now.utc,
|
147
|
-
'our tests',
|
148
|
-
'retry' => true)
|
149
|
-
|
150
|
-
json_data = JSON.parse(json)
|
151
|
-
|
152
|
-
expect(json_data).to include(
|
153
|
-
'@status' => 'retry',
|
154
|
-
)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
data/spec/spec_helper.rb
DELETED