infinum_graylog 0.11.0 → 0.12.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ecccc453d879a760efdc5911d6dbe6fa4ab247db8c2526f1efa37d26e31a23
|
4
|
+
data.tar.gz: 5c8b8e51604a0ea368949ad44acfd1a5bdf19ba542fc54c512899c98c9817705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96692cb33c879683f03a5ee87b6899bfe51561b79864fa90db72095280bc9e9fb73cc8bec2013fe9ac34206613d454c35c40f9f274299c3fc95beaf0b691eb24
|
7
|
+
data.tar.gz: 16b6d01cc003a52abe61a8cd8ccb15e5a77714857d33432f20dfbebb898c640ad2d2848ca483cdf36215ab5e545aadd9e7d0acff8e0afa841dc6cadb03dc0593
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ InfinumGraylog.configure do |config|
|
|
23
23
|
# config.skip_environments = ['development', 'test']
|
24
24
|
# config.skip_statuses = [404, 500]
|
25
25
|
# config.skippable_sql_actions = ['PhrasingPhrase Load', 'PhrasingImage Load']
|
26
|
+
# config.types = [:sql, :request]
|
26
27
|
end
|
27
28
|
|
28
29
|
InfinumGraylog::Subscriber.subscribe
|
@@ -19,7 +19,7 @@ module InfinumGraylog
|
|
19
19
|
|
20
20
|
class Configuration
|
21
21
|
attr_accessor :application, :protocol, :level, :options, :host, :port, :skip_environments
|
22
|
-
attr_accessor :skip_statuses, :skippable_sql_actions
|
22
|
+
attr_accessor :skip_statuses, :skippable_sql_actions, :types
|
23
23
|
|
24
24
|
def initialize
|
25
25
|
@application = "#{Rails.application.class.parent_name.underscore}-#{Rails.env}"
|
@@ -37,6 +37,7 @@ module InfinumGraylog
|
|
37
37
|
@skip_environments = ['development', 'test']
|
38
38
|
@skip_statuses = [404, 500]
|
39
39
|
@skippable_sql_actions = []
|
40
|
+
@types = [:sql, :request]
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module InfinumGraylog
|
2
2
|
class ProcessActionController
|
3
|
+
TYPE = :request
|
4
|
+
|
3
5
|
attr_reader :event
|
4
6
|
|
5
7
|
def initialize(event)
|
@@ -7,15 +9,16 @@ module InfinumGraylog
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def format
|
12
|
+
return unless configuration.types.include?(TYPE)
|
10
13
|
return if configuration.skip_statuses.include?(event_status)
|
11
14
|
|
12
15
|
{
|
13
16
|
short_message: event_name,
|
14
|
-
type:
|
17
|
+
type: :request,
|
15
18
|
duration: event.duration,
|
16
19
|
application: configuration.application,
|
17
20
|
status: event_status,
|
18
|
-
headers: headers
|
21
|
+
headers: headers
|
19
22
|
}.reverse_merge(cleaned_payload)
|
20
23
|
end
|
21
24
|
|
@@ -28,6 +31,7 @@ module InfinumGraylog
|
|
28
31
|
def event_status
|
29
32
|
return event.payload[:status] if event.payload[:status].present?
|
30
33
|
return 0 if event.payload[:exception].blank?
|
34
|
+
|
31
35
|
ActionDispatch::ExceptionWrapper.status_code_for_exception(event.payload[:exception].first)
|
32
36
|
end
|
33
37
|
|
@@ -37,18 +41,19 @@ module InfinumGraylog
|
|
37
41
|
|
38
42
|
def headers
|
39
43
|
return nil unless event.payload[:headers]
|
44
|
+
|
40
45
|
headers = {}
|
41
46
|
|
42
47
|
event.payload[:headers].each do |key, value|
|
43
|
-
if key.to_s.start_with?(
|
48
|
+
if key.to_s.start_with?('HTTP_')
|
44
49
|
header_key = key[5..-1]
|
45
|
-
elsif [
|
50
|
+
elsif %w[CONTENT_TYPE CONTENT_LENGTH].include?(key)
|
46
51
|
header_key = key
|
47
52
|
else
|
48
53
|
next
|
49
54
|
end
|
50
55
|
|
51
|
-
headers[header_key.split(
|
56
|
+
headers[header_key.split('_').map(&:capitalize).join('-')] = value
|
52
57
|
end
|
53
58
|
|
54
59
|
headers
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module InfinumGraylog
|
2
2
|
class SqlActiveRecord
|
3
|
+
TYPE = :sql
|
3
4
|
SKIPPABLE_ACTIONS = ['SCHEMA', 'ActiveRecord::SchemaMigration Load', 'CACHE']
|
4
5
|
|
5
6
|
attr_reader :event, :trace
|
@@ -10,13 +11,14 @@ module InfinumGraylog
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def format
|
14
|
+
return unless configuration.types.include?(TYPE)
|
13
15
|
return if event.payload[:statement_name].nil? && event.payload[:name].nil?
|
14
16
|
return if skippable_actions.include?(event_name)
|
15
17
|
|
16
18
|
{
|
17
19
|
short_message: event_name,
|
18
20
|
sql: sql,
|
19
|
-
type:
|
21
|
+
type: TYPE,
|
20
22
|
duration: event.duration,
|
21
23
|
application: configuration.application,
|
22
24
|
trace: Rails.backtrace_cleaner.clean(trace)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infinum_graylog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|