zuora_connect 1.5.40k → 1.5.40m
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f531eec6fa72b6f9651a6961a64eda3cd0ce741f
|
4
|
+
data.tar.gz: 0eb620aa24830ce66a9572856a01dc6fd637daf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0d4e8e12a915fc5fd5f2da1b24d1edb0cc7376422733a871072b4c4df03112b51f0bb7714cec20b61ac52b5a886de5bbd8dd5b48d3718d3e7543c06f2c1cb6
|
7
|
+
data.tar.gz: dbf20a23eacd142c6d91e764f7e3af84389269ee3ee3ebcc9caf2b309e9d08e3753a5893628bcb05ef59895a48c35943b6d4f6e6cc9d8220024a6d3028d01ba0
|
@@ -39,6 +39,10 @@ module ZuoraConnect
|
|
39
39
|
return p_type
|
40
40
|
end
|
41
41
|
|
42
|
+
# payloads with 500 requests do not have status as it is not set by the controller
|
43
|
+
# https://github.com/rails/rails/issues/33335
|
44
|
+
status_code = payload[:status] ? payload[:status] : payload[:exception_object].present? ? 500 : ""
|
45
|
+
|
42
46
|
# Write to telegraf
|
43
47
|
def self.write_to_telegraf(endpoint_name: nil, method_name: nil, status_code: nil, response_time: nil, db_runtime: nil, view_runtime: nil, content_type: nil, direction: nil, error_type: nil, app_instance: nil, function_name: nil)
|
44
48
|
|
@@ -4,26 +4,30 @@ module Middleware
|
|
4
4
|
# Object of this class is passed to the ActiveSupport::Notification hook
|
5
5
|
class PageRequest
|
6
6
|
|
7
|
-
# This method is triggered when a non error page is loaded (not 404
|
7
|
+
# This method is triggered when a non error page is loaded (not 404)
|
8
8
|
def call(name, started, finished, unique_id, payload)
|
9
9
|
|
10
|
-
|
10
|
+
# If the url contains any css or JavaScript files then do not collect metrics for them
|
11
|
+
block_words = ["css", "assets", "jpg", "png", "jpeg", "ico"]
|
12
|
+
if block_words.any? { |word| payload[:path].include?(word) }
|
13
|
+
return nil
|
14
|
+
end
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
# Getting the endpoint and the content_type
|
17
|
+
content_hash = {:html => "text/html", :js => "application/javascript", :json => "application/json"}
|
18
|
+
content_hash.key?(payload[:format]) ? content_type = content_hash[payload[:format]] : content_type = payload[:format]
|
19
|
+
request_path = "#{payload[:controller]}##{payload[:action]}"
|
20
|
+
response_time = finished-started
|
17
21
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
status_code = payload[:status] ? payload[:status] : ""
|
23
|
+
|
24
|
+
# payloads with 500 requests do not have status as it is not set by the controller
|
25
|
+
# https://github.com/rails/rails/issues/33335
|
26
|
+
status_code = 500 if payload[:exception_object].present?
|
27
|
+
|
28
|
+
# Write to telegraf
|
29
|
+
ZuoraConnect::AppInstanceBase.write_to_telegraf("endpoint_name": request_path, "method_name": payload[:method], "status_code": status_code, "response_time": response_time, "db_runtime": payload[:db_runtime].to_f, "view_runtime": payload[:view_runtime], "content_type": content_type, "direction": "inbound")
|
23
30
|
|
24
|
-
# Write to telegraf
|
25
|
-
ZuoraConnect::AppInstanceBase.write_to_telegraf("endpoint_name": request_path, "method_name": payload[:method], "status_code": payload[:status], "response_time": response_time, "db_runtime": payload[:db_runtime].to_f, "view_runtime": payload[:view_runtime], "content_type": content_type, "direction": "inbound")
|
26
|
-
end
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
@@ -82,18 +86,21 @@ module Middleware
|
|
82
86
|
end
|
83
87
|
|
84
88
|
# Writing to telegraf: Handle 404 and 500 requests
|
85
|
-
if @status
|
89
|
+
if @status == 404 || @status == 304
|
86
90
|
# Getting the endpoint and content_type
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
request_path = @status == 404 ? "ActionController#RoutingError" : env["action_controller.instance"].present? ? "#{env["action_controller.instance"].class}##{env["action_controller.instance"].action_name}" : ""
|
92
|
+
|
93
|
+
# Uncomment following block of code for handling engine requests/requests without controller
|
94
|
+
# else
|
95
|
+
# # Handling requests which do not have controllers (engines)
|
96
|
+
# if env["SCRIPT_NAME"].present?
|
97
|
+
# controller_path = "#{env['SCRIPT_NAME'][1..-1]}"
|
98
|
+
# controller_path = controller_path.sub("/", "::")
|
99
|
+
# request_path = "#{controller_path}#UnknownAction"
|
100
|
+
# end
|
101
|
+
|
95
102
|
content_type = @headers['Content-Type'].split(';')[0] if @headers['Content-Type']
|
96
|
-
ZuoraConnect::AppInstanceBase.write_to_telegraf("endpoint_name": request_path, "method_name": env['REQUEST_METHOD'], "status_code": @status, "response_time": response_time, "content_type": content_type, "direction": "inbound")
|
103
|
+
ZuoraConnect::AppInstanceBase.write_to_telegraf("endpoint_name": request_path, "method_name": env['REQUEST_METHOD'], "status_code": @status, "response_time": response_time, "content_type": content_type, "direction": "inbound") if request_path.present?
|
97
104
|
end
|
98
105
|
|
99
106
|
[@status, @headers, @response]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.40m
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|