logbrew-sdk 0.1.14 → 0.1.16
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 +4 -4
- data/lib/logbrew/rails_integration.rb +1 -1
- data/lib/logbrew/sidekiq.rb +5 -2
- data/lib/logbrew/version.rb +1 -1
- data/lib/logbrew.rb +10 -7
- 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: 8075c14ec60f98ac264ce2b20a74fed5ae9227e241d1939693a57301d9f1e99c
|
|
4
|
+
data.tar.gz: 34c6c4582c281f712a551f2fe4484be80b910b71517c361eadfc7b809393ee48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4dae9919321d0fda4baf9ddc50bcc2b0f23e17f53300e8fd6bcd733409abc989b093de9a979a10912e891abd97867119cdb21c47ba7dad680e26f7ff2a753789
|
|
7
|
+
data.tar.gz: ebfabd056b82f15ad40dbe6c46603529f37800b0b32b58510f030c5f46f4e7f116ca3c7800d13835aa3dccbbd65781a6f13c6085820914f722e9a5bd2ad47da6
|
data/README.md
CHANGED
|
@@ -23,7 +23,7 @@ needed:
|
|
|
23
23
|
|
|
24
24
|
```ruby
|
|
25
25
|
# Gemfile
|
|
26
|
-
gem "logbrew-sdk", "~> 0.1.
|
|
26
|
+
gem "logbrew-sdk", "~> 0.1.16"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```bash
|
|
@@ -91,7 +91,7 @@ The explicit Rails capture settings are:
|
|
|
91
91
|
| `LOGBREW_RELEASE` | unset | Optional release identifier |
|
|
92
92
|
| `LOGBREW_ENDPOINT` | `https://api.logbrew.co/v1/events` | HTTPS intake URL; loopback HTTP is accepted for local development |
|
|
93
93
|
| `LOGBREW_REQUEST_TIMEOUT_MS` | `10000` | Per-request delivery timeout from 1 to 600000 ms |
|
|
94
|
-
| `LOGBREW_FLUSH_INTERVAL_MS` | `
|
|
94
|
+
| `LOGBREW_FLUSH_INTERVAL_MS` | `1000` | Automatic delivery interval after the first queued event, from 10 to 3600000 ms |
|
|
95
95
|
| `LOGBREW_FLUSH_THRESHOLD` | `100` | Queue size from 1 to 1000 that requests an earlier flush |
|
|
96
96
|
| `LOGBREW_CAPTURE_EXCEPTION_MESSAGES` | `false` | Opt in to exception message capture |
|
|
97
97
|
| `LOGBREW_CAPTURE_RAILS_LOGS` | `false` | Opt in to bounded application-origin logs on active request and job traces |
|
|
@@ -692,7 +692,7 @@ client = LogBrew::Client.create_automatic(
|
|
|
692
692
|
sdk_name: "checkout-worker",
|
|
693
693
|
sdk_version: "1.0.0",
|
|
694
694
|
transport: transport,
|
|
695
|
-
flush_interval:
|
|
695
|
+
flush_interval: 1,
|
|
696
696
|
flush_threshold: 100,
|
|
697
697
|
retry_base_delay: 0.25,
|
|
698
698
|
retry_max_delay: 30,
|
|
@@ -704,7 +704,7 @@ warn JSON.generate(client.delivery_health.to_h)
|
|
|
704
704
|
client.shutdown
|
|
705
705
|
```
|
|
706
706
|
|
|
707
|
-
The worker starts only after accepted queue work exists, then wakes when the queue reaches `flush_threshold` or `flush_interval` expires. Restart-hydrated persistent work wakes it immediately. Automatic and manual sends share the existing serialized flush, immutable failed prefix, accepted-prefix acknowledgement, batch bounds, and persistence format; no second queue or transport path is created.
|
|
707
|
+
The worker starts only after accepted queue work exists, then wakes when the queue reaches `flush_threshold` or `flush_interval` expires. The defaults are 1 second and 100 events, so a single event is readable in about a second while bursts still share one request. Restart-hydrated persistent work wakes it immediately. Automatic and manual sends share the existing serialized flush, immutable failed prefix, accepted-prefix acknowledgement, batch bounds, and persistence format; no second queue or transport path is created.
|
|
708
708
|
|
|
709
709
|
Retryable network, `408`, and `5xx` failures retain the exact failed body and use capped equal-jitter backoff. Authentication (`401`/`403`), quota (`429`), validation (`400`/`422`), and other non-retryable responses pause automatic sends without dropping queued work. `recover_automatic_delivery` performs one explicit synchronous flush through the owned transport and resumes scheduling only after success. Calling `flush(transport)` directly provides the same explicit recovery boundary. `stop_automatic_delivery` joins the worker without draining or discarding work; a later manual flush remains available.
|
|
710
710
|
|
|
@@ -12,7 +12,7 @@ module LogBrew
|
|
|
12
12
|
class Configuration
|
|
13
13
|
DEFAULT_ENDPOINT = LogBrew::HttpTransport::DEFAULT_ENDPOINT
|
|
14
14
|
DEFAULT_REQUEST_TIMEOUT_MS = 10_000
|
|
15
|
-
DEFAULT_FLUSH_INTERVAL_MS =
|
|
15
|
+
DEFAULT_FLUSH_INTERVAL_MS = 1_000
|
|
16
16
|
DEFAULT_FLUSH_THRESHOLD = 100
|
|
17
17
|
MAX_LABEL_BYTES = 255
|
|
18
18
|
MAX_ENDPOINT_BYTES = 2_048
|
data/lib/logbrew/sidekiq.rb
CHANGED
|
@@ -230,7 +230,9 @@ module LogBrew
|
|
|
230
230
|
end
|
|
231
231
|
return yield if operation.nil?
|
|
232
232
|
|
|
233
|
-
terminal = terminal_failure?(
|
|
233
|
+
terminal = terminal_failure?(
|
|
234
|
+
job["retry"], retry_count, initial_attempt: !job.key?("retry_count")
|
|
235
|
+
)
|
|
234
236
|
operation.around(terminal_failure: terminal) { yield }
|
|
235
237
|
end
|
|
236
238
|
|
|
@@ -364,13 +366,14 @@ module LogBrew
|
|
|
364
366
|
value
|
|
365
367
|
end
|
|
366
368
|
|
|
367
|
-
def terminal_failure?(retry_setting, retry_count)
|
|
369
|
+
def terminal_failure?(retry_setting, retry_count, initial_attempt:)
|
|
368
370
|
return false if retry_count.nil?
|
|
369
371
|
return true if retry_setting == false || retry_setting == 0
|
|
370
372
|
return false unless retry_setting.nil? || retry_setting == true || retry_setting.is_a?(Integer)
|
|
371
373
|
|
|
372
374
|
limit = retry_setting.is_a?(Integer) ? retry_setting : @max_retries
|
|
373
375
|
return false if limit.negative?
|
|
376
|
+
return false if initial_attempt && limit.positive?
|
|
374
377
|
|
|
375
378
|
retry_count >= [limit - 1, 0].max
|
|
376
379
|
end
|
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)
|
|
@@ -829,7 +832,7 @@ module LogBrew
|
|
|
829
832
|
end
|
|
830
833
|
|
|
831
834
|
class Client
|
|
832
|
-
DEFAULT_AUTOMATIC_FLUSH_INTERVAL =
|
|
835
|
+
DEFAULT_AUTOMATIC_FLUSH_INTERVAL = 1.0
|
|
833
836
|
DEFAULT_AUTOMATIC_FLUSH_THRESHOLD = 100
|
|
834
837
|
DEFAULT_AUTOMATIC_RETRY_BASE_DELAY = 0.25
|
|
835
838
|
DEFAULT_AUTOMATIC_RETRY_MAX_DELAY = 30.0
|
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.16
|
|
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-19 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.
|