logbrew-sdk 0.1.5 → 0.1.6
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/rails_integration.rb +11 -6
- data/lib/logbrew/version.rb +1 -1
- data/lib/logbrew.rb +7 -3
- 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: 4e89660190354962ae56323ce67dd3192d2b6ac7fc52f73fefe8cca3e4cffe31
|
|
4
|
+
data.tar.gz: d92f16257ab1911e72f025f0b1fa29a85138e522653a68fdd4466e8f5c0311c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83d428f770034749b2c6717eb7fae953a21671bd050406822f341e7f06494af15849d1ac58b259ab08c2910f161e7bf8321fa3b3b6867b8bb14b048883b0a684
|
|
7
|
+
data.tar.gz: b60cd4f0f853c45fd656d16605b23bafa4fd2396f56be9c2be7ba8da3aa358a33510082f0ca49a45222690caea01bc1b5c3997ab30819ada8a8bde311963a617
|
data/README.md
CHANGED
|
@@ -419,6 +419,15 @@ module LogBrew
|
|
|
419
419
|
"rails-exception"
|
|
420
420
|
end
|
|
421
421
|
|
|
422
|
+
def exception_status_code(error)
|
|
423
|
+
return super unless defined?(::ActionDispatch::ExceptionWrapper)
|
|
424
|
+
|
|
425
|
+
status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(error.class.name)
|
|
426
|
+
status.is_a?(Integer) && status.between?(400, 599) ? status : super
|
|
427
|
+
rescue StandardError
|
|
428
|
+
super
|
|
429
|
+
end
|
|
430
|
+
|
|
422
431
|
def request_name(env)
|
|
423
432
|
"#{request_method(env)} #{route_template(env)}"
|
|
424
433
|
end
|
|
@@ -438,9 +447,7 @@ module LogBrew
|
|
|
438
447
|
metadata.delete("action_dispatch.request_id")
|
|
439
448
|
metadata.delete("HTTP_X_REQUEST_ID")
|
|
440
449
|
metadata["source"] = "rails"
|
|
441
|
-
metadata["http.method"] = request_method(env)
|
|
442
450
|
metadata["http.route"] = route_template(env)
|
|
443
|
-
metadata["http.status_code"] = status_code
|
|
444
451
|
metadata["http.status_class"] = "#{status_code.to_i / 100}xx"
|
|
445
452
|
controller, action = controller_and_action(env)
|
|
446
453
|
metadata["rails.controller"] = controller unless controller.nil?
|
|
@@ -449,10 +456,8 @@ module LogBrew
|
|
|
449
456
|
end
|
|
450
457
|
|
|
451
458
|
def route_template(env)
|
|
452
|
-
route = bounded_route(env_value(env, "action_dispatch.route_uri_pattern"))
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
route = bounded_route(matched_route_pattern(env))
|
|
459
|
+
route = bounded_route(env_value(env, "action_dispatch.route_uri_pattern")) ||
|
|
460
|
+
bounded_route(matched_route_pattern(env))
|
|
456
461
|
return route unless route.nil?
|
|
457
462
|
|
|
458
463
|
controller, action = controller_and_action(env)
|
data/lib/logbrew/version.rb
CHANGED
data/lib/logbrew.rb
CHANGED
|
@@ -406,10 +406,10 @@ module LogBrew
|
|
|
406
406
|
begin
|
|
407
407
|
response = @app.call(env)
|
|
408
408
|
rescue StandardError => error
|
|
409
|
+
status_code = exception_status_code(error)
|
|
409
410
|
safely_capture do
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
capture_request_span(env, 500, elapsed_ms, "error")
|
|
411
|
+
capture_exception_issue(env, error) if status_code >= 500
|
|
412
|
+
capture_request_span(env, status_code, duration_ms(started_at), status_code >= 500 ? "error" : "ok")
|
|
413
413
|
flush_if_configured
|
|
414
414
|
end
|
|
415
415
|
raise
|
|
@@ -425,6 +425,10 @@ module LogBrew
|
|
|
425
425
|
|
|
426
426
|
private
|
|
427
427
|
|
|
428
|
+
def exception_status_code(_error)
|
|
429
|
+
500
|
|
430
|
+
end
|
|
431
|
+
|
|
428
432
|
def capture_request_span(env, status_code, elapsed_ms, status)
|
|
429
433
|
@client.span(
|
|
430
434
|
next_event_id("span"),
|
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.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- LogBrew
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-11 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.
|