zuora_observability 0.3.0 → 0.3.4

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: 664115d7965e1d549ab2bb227565f51379a7ba3cc4ca0205d80523024918e0f4
4
- data.tar.gz: 2ce847ad2f5ed52a267c2cbf2ea5496a1d700d78240b3680fc25f037c5fd0d8a
3
+ metadata.gz: 91f680541f7eca83fa2a24aa721bb70c36b266e3ed2688b4311d4aa357cba5a8
4
+ data.tar.gz: 73bba0de9a68376e11484881afcc38280a0f6b7aa53ffba1cf9c8013289f42d5
5
5
  SHA512:
6
- metadata.gz: dd64817b0143ae8213875a024da8c3546d4b70fba916ca930860dab84a66522ae25733657f3a929a1d12161ce7d24dc7c305a4df98a13576c9d10e55f1116bef
7
- data.tar.gz: ece638c0238dd314be5cdc3ed5a62317f44c3eb15f75bdf63a6443024cbd7a5f89619cf7d0ed7d7c282e7a9cdb4201259ac1c15e1eddd4d1cbc00c4cbb3f8e65
6
+ metadata.gz: e36d3484052f8a857aaf17fac5fb2c142e6f6370ff9b0d19ae6a8088948e2920c9d524bd737303a790bd060f2205c8d14cb2b0a500e30ef579a8c52a52af6592
7
+ data.tar.gz: d0921b1f65bc227f695f995f657732e38c549a53f89a4b967df89d2e669b99d30b88d392e8d0bb1a4b9535a747de3db5c22ee203cf76ac918e17875905f29210
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ module TaggedLogging
5
+ # Patch to apply structured tags to Tagged Logs
6
+ module Formatter
7
+ def call(severity, timestamp, progname, data)
8
+ super(severity, timestamp, progname, merged_tags.merge!(data))
9
+ end
10
+
11
+ private
12
+
13
+ def merged_tags
14
+ tags = {}
15
+
16
+ current_tags.each do |tag|
17
+ tags.merge!(tag) if tag.is_a?(Hash)
18
+ end
19
+
20
+ tags
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ module Rails
27
+ module Rack
28
+ # Patch to compute structured tags for Tagged Logging
29
+ class Logger
30
+ private
31
+
32
+ def compute_tags(request)
33
+ {
34
+ trace_id: request.uuid
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
@@ -15,6 +15,8 @@ module ZuoraObservability
15
15
 
16
16
  next unless ZuoraObservability.configuration.json_logging
17
17
 
18
+ config.logger = ActiveSupport::TaggedLogging.new(config.logger)
19
+
18
20
  require 'lograge'
19
21
  require 'zuora_observability/logging/custom_options'
20
22
 
@@ -59,6 +59,11 @@ module ZuoraObservability
59
59
  if type == :ougai
60
60
  logger = new($stdout, level: level, progname: name)
61
61
  else
62
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
63
+ Creating a non-ougai custom_logger is deprecated and will be removed
64
+ in a future version of zuora_observability.
65
+ MSG
66
+
62
67
  require 'mono_logger'
63
68
  logger = MonoLogger.new(STDOUT)
64
69
  logger.level = level
@@ -25,7 +25,6 @@ module ZuoraObservability
25
25
  items = {
26
26
  msg: 'Rails Request',
27
27
  params: event.payload[:params].as_json(except: IGNORE_PARAMS).to_s,
28
- trace_id: event.payload[:headers]['action_dispatch.request_id'],
29
28
  zuora_trace_id: event.payload[:headers]['HTTP_ZUORA_REQUEST_ID'],
30
29
  error: event.payload[:exception_object]
31
30
  }
@@ -155,6 +155,7 @@ module ZuoraObservability
155
155
  def base_fields(data)
156
156
  {
157
157
  cp_id: data[:zuora_track_id],
158
+ entity_ids: data[:entity_ids],
158
159
  environment: data[:environment],
159
160
  tenant_id: data[:tenant_ids],
160
161
  trace_id: data[:zuora_trace_id]
@@ -164,11 +165,12 @@ module ZuoraObservability
164
165
  # zuora.http
165
166
  def http_fields(data)
166
167
  z_http_request = {
167
- headers: data[:headers],
168
+ headers: data[:headers] || data.dig(:request, :headers),
168
169
  headers_blob: data.dig(:request, :headers_blob)
169
170
  }.compact
170
171
 
171
172
  z_http_response = {
173
+ headers: data.dig(:response, :headers),
172
174
  headers_blob: data.dig(:response, :headers_blob)
173
175
  }.compact
174
176
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraObservability
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_observability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hartley McGuire
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lograge
@@ -247,11 +247,9 @@ files:
247
247
  - app/controllers/zuora_observability/application_controller.rb
248
248
  - app/controllers/zuora_observability/metrics_controller.rb
249
249
  - app/helpers/zuora_observability/application_helper.rb
250
- - app/jobs/zuora_observability/application_job.rb
251
- - app/mailers/zuora_observability/application_mailer.rb
252
- - app/models/zuora_observability/application_record.rb
253
250
  - app/views/layouts/zuora_observability/application.html.erb
254
251
  - config/initializers/loggers.rb
252
+ - config/initializers/tagged_logging.rb
255
253
  - config/routes.rb
256
254
  - lib/tasks/zuora_observability_tasks.rake
257
255
  - lib/zuora_observability.rb
@@ -282,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
280
  - !ruby/object:Gem::Version
283
281
  version: '0'
284
282
  requirements: []
285
- rubygems_version: 3.2.15
283
+ rubygems_version: 3.2.22
286
284
  signing_key:
287
285
  specification_version: 4
288
286
  summary: Summary of ZuoraObservability.
@@ -1,4 +0,0 @@
1
- module ZuoraObservability
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module ZuoraObservability
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end
@@ -1,5 +0,0 @@
1
- module ZuoraObservability
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
5
- end