logjam_agent 0.36.0 → 0.37.1

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: 238a6d18a9fdd1fdf660314a3e3de7706e658e08ab304aa4874d7e73985c787d
4
- data.tar.gz: 208a910c0abadf9572d1e9f872eee8b90c8d3706e9a59bf8c550d64cb1144281
3
+ metadata.gz: 742e6f9309275b7812a62a148595786476ca341a7082b95e1befda8e2e5ab695
4
+ data.tar.gz: c83bd0d0ec3d9c5c48b551b2c1f21d11f70fc2bb770a64ee945f63385a57515b
5
5
  SHA512:
6
- metadata.gz: f1852e9eec5abceed5a8ddd8977188a1a86ae415c6883e01db30d5471e0d20def84c07ad1eadb947e1809860c61e72010ad8dbb2aaaf92c6c842f3f3029708e5
7
- data.tar.gz: 5565c68259a98b4561240cc3f2a1bd1233598efa3aeca555db6c78183d0064376e5d3f1acfd13469bee5654e8565bee217843f7bd965b49d93a586662db4d1f3
6
+ metadata.gz: 25885e7f6b4471efe71c4b94faffdd2722f9148664eb97a9793b72a41a2db018b0d71a5e7bf3cb0a04e151389d29084be515f2ba3bd65db5b5aa449e6922e853
7
+ data.tar.gz: 44bf35a0e932444aaac1c0152520d23b62c4208ac56154470ebd5eb7f259275e9bd05d7ee9c0577a4c7a6c9ef648041a6a969a6ae7843ec6249c90367f8eaa67
@@ -106,6 +106,9 @@ module LogjamAgent
106
106
  logjam_request.ignore!(:asset) if ignored_asset_request?(path)
107
107
  logjam_request.ignore!(:url) if ignored_request_url?(path)
108
108
 
109
+ logjam_request.log_info[:path] = path
110
+ logjam_request.log_info[:method] = request.method
111
+
109
112
  logjam_request.start_time = start_time
110
113
  logjam_fields = logjam_request.fields
111
114
  logjam_fields[:wait_time] = wait_time_ms if wait_time_ms > 0.0
@@ -119,7 +122,9 @@ module LogjamAgent
119
122
  logjam_fields.merge!(:ip => ip, :host => @hostname)
120
123
  logjam_fields.merge!(extract_request_info(request))
121
124
 
122
- info "Started #{request.request_method} \"#{path}\" for #{ip} at #{start_time.to_default_s}" unless logjam_request.ignored?(:asset)
125
+ LogjamAgent.logjam_only do
126
+ info "Started #{request.request_method} \"#{path}\" for #{ip} at #{start_time.to_default_s}" unless logjam_request.ignored?(:asset)
127
+ end
123
128
  if spoofed
124
129
  error spoofed
125
130
  raise spoofed
@@ -146,9 +151,20 @@ module LogjamAgent
146
151
  warn LogjamAgent::NegativeWaitTime.new("#{wait_time_ms} ms")
147
152
  end
148
153
 
149
- message = "Completed #{status} #{::Rack::Utils::HTTP_STATUS_CODES[status]} in %.1fms" % run_time_ms
150
- message << " (#{additions.join(' | ')})" unless additions.blank?
151
- info message unless logjam_request.ignored?(:asset)
154
+ http_status = "#{status} #{::Rack::Utils::HTTP_STATUS_CODES[status]}"
155
+ LogjamAgent.logjam_only do
156
+ message = "Completed #{http_status} in %.1fms" % run_time_ms
157
+ message << " (#{additions.join(' | ')})" unless additions.blank?
158
+ info message unless logjam_request.ignored?(:asset)
159
+ end
160
+ if LogjamAgent.selective_logging_enabled
161
+ LogjamAgent.logdevice_only do
162
+ logjam_request.log_info[:status] = status
163
+ logjam_request.log_info[:duration] = run_time_ms
164
+ # logjam_request.log_info[:metrics] = TimeBandits.metrics.reject{|k,v| v.zero?}
165
+ info "Completed: #{logjam_request.log_info.to_json}"
166
+ end
167
+ end
152
168
 
153
169
  ActiveSupport::LogSubscriber.flush_all!
154
170
  request_info = { :total_time => run_time_ms, :code => status }
@@ -16,10 +16,18 @@ module ActionController #:nodoc:
16
16
  full_name = "#{controller}##{action}"
17
17
  action_name = LogjamAgent.action_name_proc.call(full_name)
18
18
 
19
- LogjamAgent.request.fields[:action] = action_name
19
+ request = LogjamAgent.request
20
+ request.fields[:action] = action_name
20
21
 
21
- info "Processing by #{full_name} as #{format}"
22
- info " Parameters: #{params.inspect}" unless params.empty?
22
+ request.log_info[:action] = action
23
+ request.log_info[:controller] = controller
24
+ request.log_info[:format] = format
25
+ # request.log_info[:params] = params
26
+
27
+ LogjamAgent.logjam_only do
28
+ info "Processing by #{full_name} as #{format}"
29
+ info " Parameters: #{params.inspect}" unless params.empty?
30
+ end
23
31
  end
24
32
  end
25
33
 
@@ -6,7 +6,7 @@ end
6
6
 
7
7
  module LogjamAgent
8
8
  class Request
9
- attr_reader :fields, :uuid, :start_time
9
+ attr_reader :fields, :uuid, :start_time, :log_info
10
10
  attr_accessor :log_device_ignored_lines
11
11
 
12
12
  def initialize(app, env, initial_fields)
@@ -39,6 +39,7 @@ module LogjamAgent
39
39
  @max_bytes_all_lines = LogjamAgent.max_bytes_all_lines
40
40
  @max_line_length = LogjamAgent.max_line_length
41
41
  @lines_dropped = false
42
+ @log_info = {}
42
43
  end
43
44
 
44
45
  def start_time=(start_time)
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.36.0"
2
+ VERSION = "0.37.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.37.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake