lamian 1.4.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d42eee8929a0bb372234198aade127f4ea73bbf7315133d2f88e6e6caff69084
4
- data.tar.gz: f173c941c4ab3d54d54a85a6c53742bfd0dab1b7b6333920dbb0ffebdebe772e
3
+ metadata.gz: 3c89ac71145ec9af5b58ff7838d164aacb7b475b927e6c2aa18d082475259490
4
+ data.tar.gz: 8bd8d8463613bb9930e8d23b36a5a964b35ac101eaead9cfb0061a14636eb29c
5
5
  SHA512:
6
- metadata.gz: 4d6f8d04d0f95eae97dd23450507d01e49afc7bfa82ec0a4d5a35db0ab06a38595e79f41a8f60f45f500bfc9dc5f0d3bc6dff77f446ad6c8d26bc42338a044b9
7
- data.tar.gz: '05872e41faae73675db913eff599a98ec497e2eaaa01335b5dcf8d54b3238e1a858d449667cfe415ec1ed17bafc38a88b9b1b4091e05e4c683ce2ab88b31e863'
6
+ metadata.gz: 6a8f70c8575eea0c877d403f3c4201befc03e5e8e4cf45d52da7bcfd09ea4a43e583c212089aefa6d686f200579129c0ff30128401f68dd5c1e1abeef49b8c85
7
+ data.tar.gz: 4668462108c871ded252b6fc90d3dde9ac6178c29bf5d067076527ea11cd1c6004f9eacf9518c305330ce3ef46f99fdb297b50812469373829d88f560aafc215
@@ -44,7 +44,7 @@ jobs:
44
44
  strategy:
45
45
  fail-fast: false
46
46
  matrix:
47
- ruby: [2.5, 2.6, 2.7]
47
+ ruby: [2.6, 2.7]
48
48
 
49
49
  steps:
50
50
  - uses: actions/checkout@v2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamian (1.4.0)
4
+ lamian (1.6.0)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
@@ -106,7 +106,7 @@ GEM
106
106
  faraday-rack (1.0.0)
107
107
  globalid (0.5.2)
108
108
  activesupport (>= 5.0)
109
- i18n (1.8.10)
109
+ i18n (1.8.11)
110
110
  concurrent-ruby (~> 1.0)
111
111
  launchy (2.5.0)
112
112
  addressable (~> 2.7)
@@ -235,9 +235,9 @@ GEM
235
235
  sprockets (4.0.2)
236
236
  concurrent-ruby (~> 1.0)
237
237
  rack (> 1, < 3)
238
- sprockets-rails (3.2.2)
239
- actionpack (>= 4.0)
240
- activesupport (>= 4.0)
238
+ sprockets-rails (3.4.0)
239
+ actionpack (>= 5.2)
240
+ activesupport (>= 5.2)
241
241
  sprockets (>= 3.0.0)
242
242
  symbiont-ruby (0.7.0)
243
243
  thor (1.1.0)
data/README.md CHANGED
@@ -47,6 +47,16 @@ You should add Lamian appender to the SematicLogger appenders like this:
47
47
  SemanticLogger.add_appender(appender: Lamian::SemanticLoggerAppender.new)
48
48
  ```
49
49
 
50
+ ### Patching Sentry Scope
51
+
52
+ If you want to send events asynchronously you need to patch `Sentry::Scope`.
53
+
54
+ ```ruby
55
+ # Somewhere in a initializer.
56
+
57
+ Sentry::Scope.prepend(Lamian::SentryScopePatch)
58
+ ```
59
+
50
60
  ## Raven (deprecated)
51
61
 
52
62
  ### Usage
data/lib/lamian/engine.rb CHANGED
@@ -17,10 +17,13 @@ module Lamian
17
17
 
18
18
  config.after_initialize do
19
19
  # :nocov:
20
- next unless defined?(Sentry)
21
- next unless Sentry.initialized?
20
+ if defined?(Sentry) && Sentry.initialized?
21
+ Sentry.configuration.before_send = rebuild_before_send
22
+ end
22
23
 
23
- Sentry.configuration.before_send = rebuild_before_send
24
+ if defined?(Sidekiq::ServerMiddleware)
25
+ Lamian::SidekiqSentryMiddleware.include(Sidekiq::ServerMiddleware)
26
+ end
24
27
  # :nocov:
25
28
  end
26
29
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lamian
4
+ # Patch for the `Sentry::Scope`. Extends the attribute accessor
5
+ # by adding an automatic lamian log dump.
6
+ # You should use this patch if you want to asynchronously send events.
7
+ # @example Prepending `Sentry::Scope` class
8
+ # Sentry::Scope.prepend(Lamian::SentryScopePatch) #=> Sentry::Scope
9
+ module SentryScopePatch
10
+ # Extra data defined in the scope.
11
+ # @return [String]
12
+ def extra
13
+ log = Lamian.dump(format: :txt)&.slice(0, Lamian.config.raven_log_size_limit)
14
+ log ? super.merge!(Lamian::SENTRY_EXTRA_KEY => log) : super
15
+ end
16
+ end
17
+ end
@@ -13,5 +13,5 @@ module Lamian
13
13
  # According to this, it is enought to specify '~> a.b'
14
14
  # if private API was not used and to specify '~> a.b.c' if it was
15
15
 
16
- VERSION = "1.4.0"
16
+ VERSION = "1.6.0"
17
17
  end
data/lib/lamian.rb CHANGED
@@ -14,6 +14,7 @@ module Lamian
14
14
  autoload :SidekiqRavenMiddleware, "lamian/sidekiq_raven_middleware"
15
15
  autoload :SidekiqSentryMiddleware, "lamian/sidekiq_sentry_middleware"
16
16
  autoload :SemanticLoggerAppender, "lamian/semantic_logger_appender"
17
+ autoload :SentryScopePatch, "lamian/sentry_scope_patch"
17
18
 
18
19
  # The key under which logs are stored in the Sentry extra data.
19
20
  SENTRY_EXTRA_KEY = :lamian_log
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lamian
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JelF
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-01 00:00:00.000000000 Z
11
+ date: 2022-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -237,6 +237,7 @@ files:
237
237
  - lib/lamian/rails_views/exception_notifier/_request_log.text.erb
238
238
  - lib/lamian/raven_context_extension.rb
239
239
  - lib/lamian/semantic_logger_appender.rb
240
+ - lib/lamian/sentry_scope_patch.rb
240
241
  - lib/lamian/sidekiq_raven_middleware.rb
241
242
  - lib/lamian/sidekiq_sentry_middleware.rb
242
243
  - lib/lamian/version.rb
@@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
260
  - !ruby/object:Gem::Version
260
261
  version: '0'
261
262
  requirements: []
262
- rubygems_version: 3.2.30
263
+ rubygems_version: 3.3.24
263
264
  signing_key:
264
265
  specification_version: 4
265
266
  summary: Add logs to your error messages