getaround_utils 0.1.9 → 0.1.11
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f7f3d0da69b7509f3053c794451828c06d884f52e99aa1e1354ce7d33d3f73b
|
4
|
+
data.tar.gz: 8de112caf848bd487de4ac5ef7fb914eca7177da431aa340a70efaaa84aa0078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f64546ec07d84d49a4401898a488fbc8d934ee9083252930751395a0bf9343e01eb1a53d7721a55a870644b11de31d935fe8a9e59b5d80ace03108f2a16c3eaa
|
7
|
+
data.tar.gz: 024771347ee39b7ae902a1cae00903786f5cbabc0ed1f4db2da0e167ef710e5597eb2c42bfce171d5bea480ebc6f1fb7299c30d85898bc07fe63523000196281
|
data/Gemfile.lock
CHANGED
@@ -3,12 +3,6 @@ module GetaroundUtils::LogFormatters; end
|
|
3
3
|
|
4
4
|
require 'getaround_utils/utils/deep_key_value_serializer'
|
5
5
|
|
6
|
-
##
|
7
|
-
# Format logs using key=value notation
|
8
|
-
#
|
9
|
-
# This logger leverage the fact that ruby Logger does not especially expect message to be string
|
10
|
-
# It will attempt to serialize message it is a string otherwise adding it as message=value
|
11
|
-
|
12
6
|
class GetaroundUtils::LogFormatters::DeepKeyValue < GetaroundUtils::Utils::DeepKeyValueSerializer
|
13
7
|
def normalize(message)
|
14
8
|
if message.is_a?(Hash)
|
@@ -37,11 +31,19 @@ class GetaroundUtils::LogFormatters::DeepKeyValue < GetaroundUtils::Utils::DeepK
|
|
37
31
|
end
|
38
32
|
|
39
33
|
module Sidekiq
|
34
|
+
def sidekiq_context
|
35
|
+
context = Thread.current&.fetch(:sidekiq_context, nil)
|
36
|
+
context.is_a?(Hash) ? context : {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def sidekiq_tid
|
40
|
+
Thread.current&.fetch('sidekiq_tid', nil) || (Thread.current&.object_id ^ ::Process.pid).to_s(36)
|
41
|
+
end
|
42
|
+
|
40
43
|
def call(severity, _datetime, appname, message)
|
41
44
|
payload = { severity: severity, appname: appname }
|
42
|
-
sidekiq =
|
43
|
-
sidekiq
|
44
|
-
"#{normalize(payload)} #{normalize(message)} #{normalize(sidekiq)}\n"
|
45
|
+
sidekiq = sidekiq_context.merge(tid: sidekiq_tid).compact
|
46
|
+
"#{normalize(payload)} #{normalize(message)} #{normalize(sidekiq: sidekiq)}\n"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -12,10 +12,10 @@ class GetaroundUtils::Patches::KeyValueSidekiqExceptions
|
|
12
12
|
|
13
13
|
def call(exception, ctx)
|
14
14
|
payload = {}
|
15
|
-
payload[:
|
15
|
+
payload[:message] = exception.message
|
16
|
+
payload[:exception] = exception.class.name
|
17
|
+
payload[:backtrace] = exception.backtrace&.join("\n")
|
16
18
|
payload[:sidekiq] = ctx
|
17
|
-
payload[:message] = exception&.message
|
18
|
-
payload[:backtrace] = exception&.backtrace&.join("\n")
|
19
19
|
Sidekiq.logger.warn(kv_formatter.serialize(payload.compact))
|
20
20
|
end
|
21
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getaround_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Drivy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-11-
|
12
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|