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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 793411c3aa680bcc6f1495db27f360bff8458c85bb423b3f45f182974b315db7
4
- data.tar.gz: 63fc654cf10a48e1531126116c43f13b740485eeda29c84997708eb7e983dae4
3
+ metadata.gz: d7aa90e88930643aedf39e351b665002ff6f58cf383bbe6a51344d2d9b5fe7a4
4
+ data.tar.gz: 15540f225f50c11d5d32f89318a6307943eda5d18eb8f38c2efa2c7c336ec4bd
5
5
  SHA512:
6
- metadata.gz: b1eb84853ea1e6155584486d11916821101517f43d62cfdcbb8be34eef6327af45c970e075757c122f91347f1d1ad78dca50af42a8f3c9cabbffcca72146b18f
7
- data.tar.gz: 5d5ad2c7364eb034e4c8c32941f591e17e341339de85d143fe59a48981a68913423bd3121555349cc97ec15f6d98e99b1556400760db402ad8ceea70abc1e0bd
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.
@@ -6,7 +6,7 @@ module InfinumGraylog
6
6
 
7
7
  def call(env)
8
8
  request = ActionDispatch::Request.new(env)
9
- InfinumGraylog::Notifier.request_id = request.request_id
9
+ InfinumGraylog::Notifier.request_id = request.uuid
10
10
  @app.call(env)
11
11
  end
12
12
  end
@@ -40,7 +40,7 @@ module InfinumGraylog
40
40
  end
41
41
 
42
42
  def request_id
43
- Thread.current[thread_key] || SecureRandom.hex
43
+ Thread.current[thread_key]
44
44
  end
45
45
  end
46
46
  end
@@ -12,7 +12,6 @@ module InfinumGraylog
12
12
  {
13
13
  short_message: event_name,
14
14
  type: 'action_controller',
15
- request_id: event.transaction_id,
16
15
  duration: event.duration,
17
16
  application: configuration.application,
18
17
  status: event_status,
@@ -1,7 +1,12 @@
1
1
  module InfinumGraylog
2
2
  class Railtie < ::Rails::Railtie
3
3
  initializer 'infinum_graylog.insert_middleware' do |app|
4
- app.config.middleware.insert_after ActionDispatch::RequestId, InfinumGraylog::Middleware
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
 
@@ -1,3 +1,3 @@
1
1
  module InfinumGraylog
2
- VERSION = '0.7.0'
2
+ VERSION = '0.9.0'
3
3
  end
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.7.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-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler