infinum_graylog 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/infinum_graylog/middleware.rb +1 -1
- data/lib/infinum_graylog/notifier.rb +1 -1
- data/lib/infinum_graylog/process_action_controller.rb +0 -1
- data/lib/infinum_graylog/railtie.rb +6 -1
- data/lib/infinum_graylog/sql_active_record.rb +5 -4
- data/lib/infinum_graylog/subscriber.rb +1 -1
- data/lib/infinum_graylog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7aa90e88930643aedf39e351b665002ff6f58cf383bbe6a51344d2d9b5fe7a4
|
4
|
+
data.tar.gz: 15540f225f50c11d5d32f89318a6307943eda5d18eb8f38c2efa2c7c336ec4bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cbf6f072802817eb13e2508781bb250b0a3405232030b75758c2a40cb1722aa87e068c8320bd6ba974200c883f48b292fcf7810a6ce9c163d419f09d617d280
|
7
|
+
data.tar.gz: 9cef470ad8f6665cd2a03d93f361e340bd5382533c1bd8240d569369f671f241814700b6b1bc15cffaa5a174dddd8d261da8e7c939a7265caf0e6ed5a8276ff0
|
data/README.md
CHANGED
@@ -29,6 +29,16 @@ InfinumGraylog::Subscriber.subscribe
|
|
29
29
|
|
30
30
|
```
|
31
31
|
|
32
|
+
If you want additional information for action processing you can add this to your controllers:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
def append_info_to_payload(payload)
|
36
|
+
super
|
37
|
+
payload[:user] = current_user.email if current_user.present?
|
38
|
+
payload[:response] = response.body if request.format == :json
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
32
42
|
## Development
|
33
43
|
|
34
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module InfinumGraylog
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
initializer 'infinum_graylog.insert_middleware' do |app|
|
4
|
-
|
4
|
+
if ActionDispatch.const_defined? :RequestId
|
5
|
+
app.config.middleware.insert_after ActionDispatch::RequestId, InfinumGraylog::Middleware
|
6
|
+
else
|
7
|
+
app.config.middleware.insert_after Rack::MethodOverride, InfinumGraylog::Middleware
|
8
|
+
end
|
5
9
|
end
|
10
|
+
|
6
11
|
end
|
7
12
|
end
|
@@ -2,10 +2,11 @@ module InfinumGraylog
|
|
2
2
|
class SqlActiveRecord
|
3
3
|
SKIPPABLE_ACTIONS = ['SCHEMA', 'ActiveRecord::SchemaMigration Load', 'CACHE']
|
4
4
|
|
5
|
-
attr_reader :event
|
5
|
+
attr_reader :event, :trace
|
6
6
|
|
7
|
-
def initialize(event)
|
7
|
+
def initialize(event, trace)
|
8
8
|
@event = event
|
9
|
+
@trace = trace
|
9
10
|
end
|
10
11
|
|
11
12
|
def format
|
@@ -16,9 +17,9 @@ module InfinumGraylog
|
|
16
17
|
short_message: event_name,
|
17
18
|
sql: sql,
|
18
19
|
type: 'sql',
|
19
|
-
request_id: event.transaction_id,
|
20
20
|
duration: event.duration,
|
21
|
-
application: configuration.application
|
21
|
+
application: configuration.application,
|
22
|
+
trace: Rails.backtrace_cleaner.clean(trace)
|
22
23
|
}
|
23
24
|
end
|
24
25
|
|
@@ -13,7 +13,7 @@ module InfinumGraylog
|
|
13
13
|
|
14
14
|
ActiveSupport::Notifications.subscribe 'sql.active_record' do |*args|
|
15
15
|
event = ActiveSupport::Notifications::Event.new(*args)
|
16
|
-
Notifier.notify(SqlActiveRecord.new(event).format)
|
16
|
+
Notifier.notify(SqlActiveRecord.new(event, caller).format)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
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.9.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-
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|