appydays 0.10.0 → 0.11.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 +4 -4
- data/lib/appydays/loggable/sidekiq_job_logger.rb +16 -2
- data/lib/appydays/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7233dee300e207e49803a368896ad6b098641db88b703d54860002055609826
|
4
|
+
data.tar.gz: 8c1d7694c1ab1695526676690900f1d5d12facee1adb4b3a823d409af22606a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45d24f4ae6769ea2bd3b42b2985c404339d6b74238c33ae15d3413d8b04088137442dc4a62710b9ed8fdc215bc1bc98f2f91c14c6370550034e5a24a2b992f5
|
7
|
+
data.tar.gz: 27ac2dc1b1ee65373c807518df6a4cb0e2038b65f6ccababc20ba89a2b3cc3bd5a1042e06c838f69ebaa054f8c88ef6e4ce42e8e61a2be063aaad61a48989020
|
@@ -43,11 +43,13 @@ class Appydays::Loggable::SidekiqJobLogger < Sidekiq::JobLogger
|
|
43
43
|
yield
|
44
44
|
duration = self.elapsed(start)
|
45
45
|
log_method = duration >= self.slow_job_seconds ? :warn : :info
|
46
|
-
self.logger.send(log_method, "job_done", duration: duration * 1000)
|
46
|
+
self.logger.send(log_method, "job_done", duration: duration * 1000, **self.class.job_tags)
|
47
47
|
rescue StandardError
|
48
48
|
# Do not log the error since it is probably a sidekiq retry error
|
49
|
-
self.logger.error("job_fail", duration: self.elapsed(start) * 1000)
|
49
|
+
self.logger.error("job_fail", duration: self.elapsed(start) * 1000, **self.class.job_tags)
|
50
50
|
raise
|
51
|
+
ensure
|
52
|
+
self.class.job_tags.clear
|
51
53
|
end
|
52
54
|
|
53
55
|
protected def elapsed(start)
|
@@ -58,6 +60,18 @@ class Appydays::Loggable::SidekiqJobLogger < Sidekiq::JobLogger
|
|
58
60
|
return ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
59
61
|
end
|
60
62
|
|
63
|
+
# Set job tags that get logged out in the "job_done" and "job_fail" messages.
|
64
|
+
# See README for more info.
|
65
|
+
# We do NOT merge the job_tags in with critical errors (death and job_error),
|
66
|
+
# since those will log the job args, and they aren't properly tested right now.
|
67
|
+
# We may add support in the future.
|
68
|
+
def self.set_job_tags(**tags)
|
69
|
+
Thread.current[:appydays_sidekiq_job_logger_job_tags] ||= {}
|
70
|
+
Thread.current[:appydays_sidekiq_job_logger_job_tags].merge!(tags)
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.job_tags = Thread.current[:appydays_sidekiq_job_logger_job_tags] || {}
|
74
|
+
|
61
75
|
def self.error_handler(ex, ctx)
|
62
76
|
# ctx looks like:
|
63
77
|
# {
|
data/lib/appydays/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appydays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lithic Tech
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|