zuora_observability 0.1.0 → 0.3.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: 52240e5716643d75479140930fd29ed88b154af9c01511fcceea92338b399ae2
4
- data.tar.gz: 20fa0460d7e665ee83b6265f69d928ed74b90fef9231e7211dac287d0e0475f0
3
+ metadata.gz: 664115d7965e1d549ab2bb227565f51379a7ba3cc4ca0205d80523024918e0f4
4
+ data.tar.gz: 2ce847ad2f5ed52a267c2cbf2ea5496a1d700d78240b3680fc25f037c5fd0d8a
5
5
  SHA512:
6
- metadata.gz: 0246f0a9836504bbd5fb8ed0e0ec909664a6848cca592a4756c47dff3153eeb763e3f7e179fe031fe65161b9bf01ffbbc396f995738501f625dcbdf9b824436e
7
- data.tar.gz: b7da319f502643521f8b229e2f33b889d9fbb6823b38b948b51d38f073f348d59affc8f84fca734635294627225766ab1ea7f2d49ac91b7b71a71c2b9e396518
6
+ metadata.gz: dd64817b0143ae8213875a024da8c3546d4b70fba916ca930860dab84a66522ae25733657f3a929a1d12161ce7d24dc7c305a4df98a13576c9d10e55f1116bef
7
+ data.tar.gz: ece638c0238dd314be5cdc3ed5a62317f44c3eb15f75bdf63a6443024cbd7a5f89619cf7d0ed7d7c282e7a9cdb4201259ac1c15e1eddd4d1cbc00c4cbb3f8e65
@@ -43,7 +43,7 @@ module ZuoraObservability
43
43
  private
44
44
 
45
45
  def app_parent_name
46
- if Rails::VERSION::MAJOR >= 6 && Rails::VERSION::MINOR >= 1
46
+ if Rails::VERSION::MAJOR >= 6
47
47
  Rails.application.class.module_parent_name
48
48
  else
49
49
  Rails.application.class.parent_name
@@ -13,6 +13,7 @@ module ZuoraObservability
13
13
  CONTENT_TYPE
14
14
  ORIGINAL_FULLPATH
15
15
  QUERY_STRING
16
+ HTTP_COOKIE
16
17
  ].freeze
17
18
 
18
19
  IGNORE_PARAMS = %w[controller action format].freeze
@@ -50,18 +50,21 @@ module ZuoraObservability
50
50
  ecs: { version: ECS_VERSION },
51
51
  log: { level: severity, logger: progname || @app_name },
52
52
  service: { name: Env.name, version: Env.version },
53
- trace: { id: data[:trace_id] }
53
+ trace: { id: data[:trace_id] },
54
+ tags: ['zecs']
54
55
  }
55
56
  end
56
57
 
57
- # error
58
+ # errors
58
59
  def error_fields(data)
59
- return {} unless data[:error]
60
+ return {} unless data[:error] || data[:err]
61
+
62
+ error = data[:err] || serialize_exc(data[:error])
60
63
 
61
64
  {
62
- message: data[:error].message,
63
- stack_trace: data[:error].backtrace.join("\n"),
64
- type: data[:error].class
65
+ message: error[:message],
66
+ stack_trace: error[:stack],
67
+ type: error[:name]
65
68
  }.compact
66
69
  end
67
70
 
@@ -72,16 +75,21 @@ module ZuoraObservability
72
75
 
73
76
  # http.request
74
77
  def request_fields(data)
78
+ request = data.slice(:method, :params).merge(data.fetch(:request, {}))
79
+
75
80
  {
76
- method: data[:method],
77
- body: ({ content: data[:params] } if data.key? :params)
81
+ method: request[:method],
82
+ body: ({ content: request[:params] } if request.key? :params)
78
83
  }.compact
79
84
  end
80
85
 
81
86
  # http.response
82
87
  def response_fields(data)
88
+ response = data.slice(:status).merge(data.fetch(:response, {}))
89
+
83
90
  {
84
- status_code: data[:status]
91
+ status_code: response[:status],
92
+ body: ({ content: response[:params] } if response.key? :params),
85
93
  }.compact
86
94
  end
87
95
 
@@ -100,6 +108,7 @@ module ZuoraObservability
100
108
  # url
101
109
  def url_fields(data)
102
110
  {
111
+ full: data.dig(:url, :full),
103
112
  path: data[:path]
104
113
  }.compact
105
114
  end
@@ -107,6 +116,7 @@ module ZuoraObservability
107
116
  # user
108
117
  def user_fields(data)
109
118
  {
119
+ id: data[:user_id],
110
120
  email: data[:email]
111
121
  }.compact
112
122
  end
@@ -144,7 +154,6 @@ module ZuoraObservability
144
154
 
145
155
  def base_fields(data)
146
156
  {
147
- apartment_id: data[:app_instance_id],
148
157
  cp_id: data[:zuora_track_id],
149
158
  environment: data[:environment],
150
159
  tenant_id: data[:tenant_ids],
@@ -154,16 +163,26 @@ module ZuoraObservability
154
163
 
155
164
  # zuora.http
156
165
  def http_fields(data)
157
- z_http_request = { headers: data[:headers] }.compact
166
+ z_http_request = {
167
+ headers: data[:headers],
168
+ headers_blob: data.dig(:request, :headers_blob)
169
+ }.compact
170
+
171
+ z_http_response = {
172
+ headers_blob: data.dig(:response, :headers_blob)
173
+ }.compact
158
174
 
159
175
  {
160
- request: (z_http_request unless z_http_request.empty?)
176
+ request: (z_http_request unless z_http_request.empty?),
177
+ response: (z_http_response unless z_http_response.empty?)
161
178
  }.compact
162
179
  end
163
180
 
164
181
  # Service's Custom Fields
165
182
  def service_fields(data)
166
- data[:zecs_service].presence || {}
183
+ {
184
+ app_instance_id: data[:app_instance_id]
185
+ }.merge(data.fetch(:zecs_service, {})).compact
167
186
  end
168
187
  end
169
188
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraObservability
4
- VERSION = '0.1.0'
4
+ VERSION = '0.3.0'
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.1.0
4
+ version: 0.3.0
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-02-03 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lograge
@@ -244,8 +244,6 @@ files:
244
244
  - MIT-LICENSE
245
245
  - README.md
246
246
  - Rakefile
247
- - app/assets/config/zuora_observability_manifest.js
248
- - app/assets/stylesheets/zuora_observability/application.css
249
247
  - app/controllers/zuora_observability/application_controller.rb
250
248
  - app/controllers/zuora_observability/metrics_controller.rb
251
249
  - app/helpers/zuora_observability/application_helper.rb
@@ -284,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
282
  - !ruby/object:Gem::Version
285
283
  version: '0'
286
284
  requirements: []
287
- rubygems_version: 3.1.4
285
+ rubygems_version: 3.2.15
288
286
  signing_key:
289
287
  specification_version: 4
290
288
  summary: Summary of ZuoraObservability.
@@ -1 +0,0 @@
1
- //= link_directory ../stylesheets/zuora_observability .css
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */