zuora_connect 3.0.0.pre.b → 3.0.0.pre.c
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/resque.rb +0 -12
- data/lib/middleware/metrics_middleware.rb +0 -31
- data/lib/zuora_connect/railtie.rb +0 -14
- data/lib/zuora_connect/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27fb22389a0778791fc2ecab5d1ad5bbd651f1b647712830b4e006102e28eecd
|
4
|
+
data.tar.gz: c5aaa8e152b214b12abf26383d46371377c4ef0fca324929e9ffc33952663600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edd9d1b187c9a517eaf91d643718ada56deec42eec78f6f570a93bcdd83e99d1b6ab1ffe41c2bb86f763139d1ab6e6ea66c36f5854a815356a5563494b990c11
|
7
|
+
data.tar.gz: 59a8465e0558022d280b08100c91ac77bdc955e55f24c19201c4d198b5720c4a3afdfa3650520fca8edcdc883fd81e2a3d152d1b1ba8b8f3c80a83d3e84e6c17
|
@@ -34,15 +34,3 @@ Resque.module_eval do
|
|
34
34
|
Hash[queue_names.zip(sizes)]
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
38
|
-
if defined?(Resque.logger)
|
39
|
-
Resque.logger = ZuoraObservability::Logger.custom_logger(name: "Resque", type: 'Monologger', level: MonoLogger::INFO)
|
40
|
-
Resque::Scheduler.logger = ZuoraObservability::Logger.custom_logger(name: "ResqueScheduler") if defined?(Resque::Scheduler)
|
41
|
-
end
|
42
|
-
if defined?(Delayed::Worker.logger)
|
43
|
-
Delayed::Worker.logger = ZuoraObservability::Logger.custom_logger(name: "DelayedJob", type: 'Monologger', level: MonoLogger::INFO)
|
44
|
-
end
|
45
|
-
|
46
|
-
Makara::Logging::Logger.logger = ZuoraObservability::Logger.custom_logger(name: "Makara") if defined?(Makara)
|
47
|
-
ElasticAPM.agent.config.logger = ZuoraObservability::Logger.custom_logger(name: "ElasticAPM", level: MonoLogger::WARN) if defined?(ElasticAPM) && ElasticAPM.running?
|
48
|
-
ActionMailer::Base.logger = ZuoraObservability::Logger.custom_logger(name: "ActionMailer", type: 'Monologger') if defined?(ActionMailer)
|
@@ -1,37 +1,6 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
require 'uri'
|
3
3
|
|
4
|
-
# Object of this class is passed to the ActiveSupport::Notification hook
|
5
|
-
class PageRequest
|
6
|
-
|
7
|
-
# This method is triggered when a non error page is loaded (not 404)
|
8
|
-
def call(name, started, finished, unique_id, payload)
|
9
|
-
# If the url contains any css or JavaScript files then do not collect metrics for them
|
10
|
-
return nil if ["css", "assets", "jpg", "png", "jpeg", "ico"].any? { |word| payload[:path].include?(word) }
|
11
|
-
|
12
|
-
# Getting the endpoint and the content_type
|
13
|
-
content_hash = {:html => "text/html", :js => "application/javascript", :json => "application/json", :csv => "text/csv"}
|
14
|
-
content_type = content_hash.key?(payload[:format]) ? content_hash[payload[:format]] : payload[:format]
|
15
|
-
content_type = content_type.to_s.gsub('text/javascript', 'application/javascript')
|
16
|
-
|
17
|
-
# payloads with 500 requests do not have status as it is not set by the controller
|
18
|
-
# https://github.com/rails/rails/issues/33335
|
19
|
-
#status_code = payload[:status] ? payload[:status] : payload[:exception_object].present? ? 500 : ""
|
20
|
-
if payload[:exception].present?
|
21
|
-
status_code, exception = [500, payload[:exception].first]
|
22
|
-
else
|
23
|
-
status_code, exception = [payload[:status], nil]
|
24
|
-
end
|
25
|
-
|
26
|
-
tags = {method: payload[:method], status: status_code, error_type: exception, content_type: content_type, controller: payload[:controller], action: payload[:action]}.compact
|
27
|
-
|
28
|
-
values = {view_time: payload[:view_runtime], db_time: payload[:db_runtime], response_time: ((finished-started)*1000)}.compact
|
29
|
-
values = values.map{ |k,v| [k,v.round(2)]}.to_h
|
30
|
-
|
31
|
-
ZuoraObservability::Metrics.write_to_telegraf(direction: :inbound, tags: tags, values: values)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
4
|
class MetricsMiddleware
|
36
5
|
|
37
6
|
require "zuora_connect/version"
|
@@ -5,17 +5,6 @@ require 'middleware/bad_multipart_form_data_sanitizer'
|
|
5
5
|
|
6
6
|
module ZuoraConnect
|
7
7
|
class Railtie < Rails::Railtie
|
8
|
-
REQUEST_HEADERS_TO_IGNORE = %W(
|
9
|
-
RAW_POST_DATA
|
10
|
-
REQUEST_METHOD
|
11
|
-
REQUEST_URI
|
12
|
-
REQUEST_PATH
|
13
|
-
PATH_INFO
|
14
|
-
CONTENT_TYPE
|
15
|
-
ORIGINAL_FULLPATH
|
16
|
-
QUERY_STRING
|
17
|
-
)
|
18
|
-
|
19
8
|
config.before_initialize do
|
20
9
|
version = Rails.version
|
21
10
|
if version >= "5.0.0"
|
@@ -43,8 +32,5 @@ module ZuoraConnect
|
|
43
32
|
app.config.middleware.use Rack::Deflater, if: ->(env, *) { env['PATH_INFO'] == '/connect/internal/metrics' }
|
44
33
|
end
|
45
34
|
end
|
46
|
-
|
47
|
-
# hook to process_action
|
48
|
-
ActiveSupport::Notifications.subscribe('process_action.action_controller', ZuoraConnect::PageRequest.new)
|
49
35
|
end
|
50
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.pre.
|
4
|
+
version: 3.0.0.pre.c
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
@@ -186,16 +186,16 @@ dependencies:
|
|
186
186
|
name: zuora_observability
|
187
187
|
requirement: !ruby/object:Gem::Requirement
|
188
188
|
requirements:
|
189
|
-
- -
|
189
|
+
- - '='
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
191
|
+
version: 0.1.0.pre.b
|
192
192
|
type: :runtime
|
193
193
|
prerelease: false
|
194
194
|
version_requirements: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
|
-
- -
|
196
|
+
- - '='
|
197
197
|
- !ruby/object:Gem::Version
|
198
|
-
version:
|
198
|
+
version: 0.1.0.pre.b
|
199
199
|
- !ruby/object:Gem::Dependency
|
200
200
|
name: rspec
|
201
201
|
requirement: !ruby/object:Gem::Requirement
|