logbrew-sdk 0.1.13 → 0.1.15
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/README.md +1 -1
- data/lib/logbrew/sidekiq.rb +23 -18
- data/lib/logbrew/version.rb +1 -1
- data/lib/logbrew.rb +9 -6
- 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: 0f1a43a336fe87e460238a865dd71006b99975d8dda5eea4556d3b7857ce7b8e
|
|
4
|
+
data.tar.gz: 6900c3207bebf800d0c41f9fb6784af6a5051f6afa2a6bf586f8ff5c9eef49f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8249769684d6d9ed2177867a5cde11f1f7ca977218c9d4b2d2d43704d54e0c38e0d0d1307f271f72003db5d2e8cb3c55094c34fcb4f940f10794ab92346a069
|
|
7
|
+
data.tar.gz: 972b7ed436cdedf8c29fec9bf75d2a2c0c73cddc5e1d3dbacbf88b7e7c9a9ffc8e6b253b93a975a60d9bca8052c0833bc3adac007ca4a09c0a5aa8a321256198
|
data/README.md
CHANGED
data/lib/logbrew/sidekiq.rb
CHANGED
|
@@ -47,7 +47,7 @@ module LogBrew
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
@instrumentation.send(:capture_span, self, error)
|
|
50
|
-
@instrumentation.send(:capture_terminal_issue, self) if error && terminal_failure && !cancellation?(error)
|
|
50
|
+
@instrumentation.send(:capture_terminal_issue, self, error) if error && terminal_failure && !cancellation?(error)
|
|
51
51
|
rescue StandardError => capture_error
|
|
52
52
|
@instrumentation.send(:report_capture_error, capture_error)
|
|
53
53
|
end
|
|
@@ -79,20 +79,22 @@ module LogBrew
|
|
|
79
79
|
}
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
def issue_attributes
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
82
|
+
def issue_attributes(error)
|
|
83
|
+
exception_type = IssueDiagnostics.safe_exception_type(error)
|
|
84
|
+
frame = IssueDiagnostics.stack_frames_from_exception(error).first
|
|
85
|
+
metadata = {
|
|
86
|
+
"source" => @source,
|
|
87
|
+
"sampled" => @context.sampled,
|
|
88
|
+
"retryCount" => @retry_count + 1,
|
|
89
|
+
"errorName" => exception_type
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
unless frame.nil?
|
|
92
|
+
metadata["errorFrameFile"] = frame.fetch("filename")
|
|
93
|
+
metadata["errorFrameLine"] = frame.fetch("line")
|
|
94
|
+
end
|
|
95
|
+
IssueDiagnostics.from_exception(
|
|
96
|
+
error, title: exception_type, mechanism_type: "sidekiq.job", handled: false, metadata: metadata
|
|
97
|
+
)
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def failure_key
|
|
@@ -228,7 +230,9 @@ module LogBrew
|
|
|
228
230
|
end
|
|
229
231
|
return yield if operation.nil?
|
|
230
232
|
|
|
231
|
-
terminal = terminal_failure?(
|
|
233
|
+
terminal = terminal_failure?(
|
|
234
|
+
job["retry"], retry_count, initial_attempt: !job.key?("retry_count")
|
|
235
|
+
)
|
|
232
236
|
operation.around(terminal_failure: terminal) { yield }
|
|
233
237
|
end
|
|
234
238
|
|
|
@@ -362,13 +366,14 @@ module LogBrew
|
|
|
362
366
|
value
|
|
363
367
|
end
|
|
364
368
|
|
|
365
|
-
def terminal_failure?(retry_setting, retry_count)
|
|
369
|
+
def terminal_failure?(retry_setting, retry_count, initial_attempt:)
|
|
366
370
|
return false if retry_count.nil?
|
|
367
371
|
return true if retry_setting == false || retry_setting == 0
|
|
368
372
|
return false unless retry_setting.nil? || retry_setting == true || retry_setting.is_a?(Integer)
|
|
369
373
|
|
|
370
374
|
limit = retry_setting.is_a?(Integer) ? retry_setting : @max_retries
|
|
371
375
|
return false if limit.negative?
|
|
376
|
+
return false if initial_attempt && limit.positive?
|
|
372
377
|
|
|
373
378
|
retry_count >= [limit - 1, 0].max
|
|
374
379
|
end
|
|
@@ -381,7 +386,7 @@ module LogBrew
|
|
|
381
386
|
)
|
|
382
387
|
end
|
|
383
388
|
|
|
384
|
-
def capture_terminal_issue(operation)
|
|
389
|
+
def capture_terminal_issue(operation, error)
|
|
385
390
|
key = operation.failure_key
|
|
386
391
|
reserved = @failure_mutex.synchronize do
|
|
387
392
|
next false if @reported_failures.key?(key)
|
|
@@ -396,7 +401,7 @@ module LogBrew
|
|
|
396
401
|
@client.issue(
|
|
397
402
|
"ruby_sidekiq_issue_#{operation.context.span_id}",
|
|
398
403
|
Time.now.utc.iso8601,
|
|
399
|
-
operation.issue_attributes
|
|
404
|
+
operation.issue_attributes(error)
|
|
400
405
|
)
|
|
401
406
|
rescue StandardError
|
|
402
407
|
@failure_mutex.synchronize { @reported_failures.delete(key) }
|
data/lib/logbrew/version.rb
CHANGED
data/lib/logbrew.rb
CHANGED
|
@@ -53,7 +53,15 @@ module LogBrew
|
|
|
53
53
|
def capture_safely
|
|
54
54
|
yield
|
|
55
55
|
rescue StandardError => error
|
|
56
|
-
|
|
56
|
+
handle_logbrew_error(error)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def handle_logbrew_error(error)
|
|
60
|
+
begin
|
|
61
|
+
@on_error.call(error) if @on_error.respond_to?(:call)
|
|
62
|
+
rescue StandardError
|
|
63
|
+
nil
|
|
64
|
+
end
|
|
57
65
|
raise error if @raise_errors
|
|
58
66
|
end
|
|
59
67
|
end
|
|
@@ -328,11 +336,6 @@ module LogBrew
|
|
|
328
336
|
flush_logbrew if @flush_on_log
|
|
329
337
|
end
|
|
330
338
|
|
|
331
|
-
def handle_logbrew_error(error)
|
|
332
|
-
@on_error.call(error) if @on_error.respond_to?(:call)
|
|
333
|
-
raise error if @raise_errors
|
|
334
|
-
end
|
|
335
|
-
|
|
336
339
|
def logbrew_message(message)
|
|
337
340
|
return message.message if message.is_a?(Exception)
|
|
338
341
|
return message if message.is_a?(String)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logbrew-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- LogBrew
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Public LogBrew Ruby SDK with typed issue diagnostics, automatic Rails
|
|
14
14
|
request/error capture, and standard-library delivery.
|