semantic_logger_ecs_addon 0.1.14 → 0.1.15

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: fab99edd113429d3c6cee4a9dbcf983943d49d0549321bb65f88200497d6c2ba
4
- data.tar.gz: 48a33c3fcd050b88ce0057f53f7a2e7476f63eeda114ec215c59c070bdd665ff
3
+ metadata.gz: 6de6d3610f967c99762b807469d81909758aa27eec64991281ddec0825acc6dd
4
+ data.tar.gz: fdf7ca5413e9f41a3b521a2321b8fbf258d222343155991532c0a7fff45e4edc
5
5
  SHA512:
6
- metadata.gz: 0a5c0a63ededccc7dffc86b6f1ab108c96813c5ef1b9c49143b0215341b4297789d94103744bc105fcbe961e9fbc589aaf1e219aacb8700cecccafea1360fcc6
7
- data.tar.gz: 5e6c4d3144b8f53a3acc88ef384023c4ad871fa8449aea0ee8893cfcb51796371fb42d455567e830fd37bb4da38751d0df4393142fa3ffb36bb039332d38a624
6
+ metadata.gz: 77df9bbedd9cf76463a41c521fc10bbd806064f958a77ed0fa54af5751cc47fcf0c5ba63b84ebd6d3008227b0f6e6f1af057c0626e96be36416a88e9cd718c30
7
+ data.tar.gz: 06caa6e1d16ab15c73e33d0d510a6d8299bec9d4ee502d261d8b3581a2574b1d2d6a55b66b8296b10db5e4d28c2d34530117137372793040fd38c54df3f96687
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "request_store_rails"
4
+ require "semantic_logger"
5
+
3
6
  module RailsSemanticLogger
4
7
  module Sequel
5
8
  class LogSubscriber < ActiveSupport::LogSubscriber
@@ -9,20 +12,20 @@ module RailsSemanticLogger
9
12
 
10
13
  def self.runtime= value
11
14
  # ::ActiveRecord::RuntimeRegistry.sql_runtime = value
12
- RequestStore.store[:sql_runtime] = value
15
+ RequestLocals.store[:sql_runtime] = value
13
16
  end
14
17
 
15
18
  def self.runtime
16
19
  # ::ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
17
- RequestStore.fetch(:sql_runtime) { 0 }
20
+ RequestLocals.fetch(:sql_runtime) { 0 }
18
21
  end
19
22
 
20
23
  def self.count= value
21
- RequestStore.store[:sql_count] = value
24
+ RequestLocals.store[:sql_count] = value
22
25
  end
23
26
 
24
27
  def self.count
25
- RequestStore.fetch(:sql_count) { 0 }
28
+ RequestLocals.fetch(:sql_count) { 0 }
26
29
  end
27
30
 
28
31
  def self.reset_runtime
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "semantic_logger/formatters/base"
4
+ require "semantic_logger_ecs_addon/utils/hash"
4
5
 
5
6
  module SemanticLoggerEcsAddon
6
7
  module Formatters
@@ -176,13 +177,17 @@ module SemanticLoggerEcsAddon
176
177
  def request
177
178
  hash[:"http.request.id"] = formatted_payload.dig :request, :request_id
178
179
  hash[:"http.request.body.content"] = formatted_payload.dig :request, :body
179
- hash[:"http.request.body.content"] = hash[:"http.request.body.content"].to_json if hash[:"http.request.body.content"].respond_to?(:to_json)
180
+ if hash[:"http.request.body.content"].respond_to?(:to_json)
181
+ hash[:"http.request.body.content"] = hash[:"http.request.body.content"].to_json
182
+ end
180
183
  hash[:"http.request.method"] = formatted_payload.dig :request, :method
181
184
  end
182
185
 
183
186
  def response
184
187
  hash[:"http.response.body.content"] = formatted_payload.dig :response, :body
185
- hash[:"http.response.body.content"] = hash[:"http.response.body.content"].to_json if hash[:"http.response.body.content"].respond_to?(:to_json)
188
+ if hash[:"http.response.body.content"].respond_to?(:to_json)
189
+ hash[:"http.response.body.content"] = hash[:"http.response.body.content"].to_json
190
+ end
186
191
  hash[:"http.response.status_code"] = formatted_payload.dig :response, :status
187
192
  end
188
193
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "oj"
4
+ require "semantic_logger_ecs_addon/formatters/raw"
4
5
 
5
6
  module SemanticLoggerEcsAddon
6
7
  module Formatters
@@ -14,7 +15,14 @@ module SemanticLoggerEcsAddon
14
15
  def call log, logger
15
16
  Oj.dump(super(log, logger), nilnil: true, escape_mode: :json, mode: :rails)
16
17
  rescue SystemStackError => _error
17
- Oj.dump(super(log, logger).transform_keys {|key| key.to_s }, nilnil: true, escape_mode: :json, mode: :object)
18
+ Oj.dump(
19
+ super(log, logger).transform_keys do |key|
20
+ key.to_s
21
+ end,
22
+ nilnil: true,
23
+ escape_mode: :json,
24
+ mode: :object
25
+ )
18
26
  end
19
27
  end
20
28
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "semantic_logger_ecs_addon/formatters/base"
4
+
3
5
  module SemanticLoggerEcsAddon
4
6
  module Formatters
5
7
  class Raw < Base
@@ -92,7 +94,9 @@ module SemanticLoggerEcsAddon
92
94
  end
93
95
 
94
96
  def extras
95
- return unless formatted_payload.respond_to?(:empty?) && !formatted_payload.empty? && formatted_payload.respond_to?(:has_key?)
97
+ unless formatted_payload.respond_to?(:empty?) && !formatted_payload.empty? && formatted_payload.respond_to?(:has_key?)
98
+ return
99
+ end
96
100
 
97
101
  hash.merge!(safe_jsonify(formatted_payload.except(:request, :response, :user)))
98
102
  end
@@ -5,7 +5,7 @@ module SemanticLoggerEcsAddon
5
5
  module Identity
6
6
  NAME = "semantic_logger_ecs_addon"
7
7
  LABEL = "Semantic Logger Ecs Addon"
8
- VERSION = "0.1.14"
8
+ VERSION = "0.1.15"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  SUMMARY = "A semantic logger formatter that formats the logs according to Elastic Common Schema, adds APM trace data if ElasticAPM is enabled and instruments sequel logs for rails if available."
11
11
  end
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pathname"
4
- require "zeitwerk"
5
-
6
- loader = Zeitwerk::Loader.for_gem
7
- loader.ignore "#{__dir__}/rails_semantic_logger"
8
- loader.ignore "#{__dir__}/sequel"
9
- loader.ignore "#{__dir__}/semantic_logger_ecs_addon/sequel.rb"
10
- loader.setup
4
+ require "semantic_logger_ecs_addon/utils/backtrace_cleaner"
5
+ require "semantic_logger_ecs_addon/utils/hash"
6
+ require "semantic_logger_ecs_addon/formatters/base"
7
+ require "semantic_logger_ecs_addon/formatters/json"
8
+ require "semantic_logger_ecs_addon/formatters/raw"
11
9
 
12
10
  # Main namespace.
13
11
  module SemanticLoggerEcsAddon
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/core_ext/module/attr_internal"
4
- unless defined?(RailsSemanticLogger::Sequel::LogSubscriber)
5
- require_relative "../../rails_semantic_logger/sequel/log_subscriber"
6
- end
4
+ require "rails_semantic_logger/sequel/log_subscriber"
7
5
 
8
6
  module Sequel
9
7
  module Railties
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_logger_ecs_addon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sajeev Ramasamy
@@ -34,7 +34,7 @@ cert_chain:
34
34
  KosCvruZx0i+xfBhrTh6f5uQ4T57DUvWiUcdHqv98HqAqyyiPuSiI46/yQgU/4D+
35
35
  ApIuwzlhHr30wJqOI8K003+GUsnMkf/7aBmCfedz5dC1EF+2J2SCdg==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-12-27 00:00:00.000000000 Z
37
+ date: 2022-01-19 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: oj
@@ -51,19 +51,19 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: '3.13'
53
53
  - !ruby/object:Gem::Dependency
54
- name: request_store
54
+ name: request_store_rails
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.5'
59
+ version: '2.0'
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.5'
66
+ version: '2.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: semantic_logger
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -78,20 +78,6 @@ dependencies:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '4.4'
81
- - !ruby/object:Gem::Dependency
82
- name: zeitwerk
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '2.4'
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '2.4'
95
81
  description:
96
82
  email:
97
83
  - thorion3006@gmail.com
@@ -109,7 +95,7 @@ files:
109
95
  - lib/semantic_logger_ecs_addon/formatters/json.rb
110
96
  - lib/semantic_logger_ecs_addon/formatters/raw.rb
111
97
  - lib/semantic_logger_ecs_addon/identity.rb
112
- - lib/semantic_logger_ecs_addon/sequel.rb
98
+ - lib/semantic_logger_ecs_addon/sequel_rails.rb
113
99
  - lib/semantic_logger_ecs_addon/utils/backtrace_cleaner.rb
114
100
  - lib/semantic_logger_ecs_addon/utils/hash.rb
115
101
  - lib/sequel/database.rb
@@ -122,6 +108,7 @@ metadata:
122
108
  changelog_uri: https://github.com/thorion3006/semantic_logger_ecs_addon/blob/master/CHANGES.md
123
109
  documentation_uri: https://github.com/thorion3006/semantic_logger_ecs_addon
124
110
  source_code_uri: https://github.com/thorion3006/semantic_logger_ecs_addon
111
+ rubygems_mfa_required: 'true'
125
112
  post_install_message:
126
113
  rdoc_options: []
127
114
  require_paths:
metadata.gz.sig CHANGED
Binary file