logjam_agent 0.12.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/logjam_agent/rack/logger.rb +4 -3
- data/lib/logjam_agent/request.rb +12 -2
- data/lib/logjam_agent/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6729159239dcd10c5f56d76ae34d34f6798c102a
|
|
4
|
+
data.tar.gz: c55ddcfb030609b5018d8452509a285cdd5264c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2d799502c05f8561e645e675e44d58dc6ef2e94c3513222d4afc3ce50a324854530cea6c2aefc8fb7574c588b3900bede0d4d03a3657ea183a709302854960e
|
|
7
|
+
data.tar.gz: abbf559d5e30c33cfd93599df6fb5aac070ddfec28abdf8fe1b8e08f05377a46335fc6e3fccabdfd2589a3b2d4a73fa6be420cd77d39ff98018672eae34c4ca0
|
data/README.md
CHANGED
|
@@ -94,7 +94,7 @@ LogjamAgent.error_handler = lambda {|exception| ... }
|
|
|
94
94
|
|
|
95
95
|
The MIT License
|
|
96
96
|
|
|
97
|
-
Copyright (c) 2013
|
|
97
|
+
Copyright (c) 2013 - 2015 Stefan Kaes
|
|
98
98
|
|
|
99
99
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
100
100
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -27,9 +27,9 @@ module LogjamAgent
|
|
|
27
27
|
|
|
28
28
|
def call_app(request, env)
|
|
29
29
|
start_time = Time.now
|
|
30
|
-
start_time_header = env['HTTP_X_STARTTIME']
|
|
30
|
+
start_time_header = env['HTTP_X_STARTTIME']
|
|
31
31
|
if start_time_header && start_time_header =~ /\At=(\d+)\z/
|
|
32
|
-
#
|
|
32
|
+
# HTTP_X_STARTTIME is microseconds since the epoch (UTC)
|
|
33
33
|
http_start_time = Time.at($1.to_f / 1_000_000.0)
|
|
34
34
|
if (wait_time_ms = (start_time - http_start_time) * 1000) > 0
|
|
35
35
|
start_time = http_start_time
|
|
@@ -75,9 +75,10 @@ module LogjamAgent
|
|
|
75
75
|
logjam_request = LogjamAgent.request
|
|
76
76
|
logjam_request.ignore! if ignored_asset_request?(path)
|
|
77
77
|
|
|
78
|
+
logjam_request.start_time = start_time
|
|
78
79
|
logjam_fields = logjam_request.fields
|
|
79
80
|
ip = LogjamAgent.ip_obfuscator(request.ip)
|
|
80
|
-
logjam_fields.merge!(:
|
|
81
|
+
logjam_fields.merge!(:ip => ip, :host => @hostname)
|
|
81
82
|
logjam_fields.merge!(extract_request_info(request))
|
|
82
83
|
|
|
83
84
|
info "Started #{request.request_method} \"#{path}\" for #{ip} at #{start_time.to_default_s}" unless logjam_request.ignored?
|
data/lib/logjam_agent/request.rb
CHANGED
|
@@ -6,7 +6,7 @@ end
|
|
|
6
6
|
|
|
7
7
|
module LogjamAgent
|
|
8
8
|
class Request
|
|
9
|
-
attr_reader :fields, :uuid
|
|
9
|
+
attr_reader :fields, :uuid, :start_time
|
|
10
10
|
|
|
11
11
|
def initialize(app, env, initial_fields)
|
|
12
12
|
@app = app
|
|
@@ -14,7 +14,11 @@ module LogjamAgent
|
|
|
14
14
|
@forwarder = Forwarders.get(app, env)
|
|
15
15
|
@lines = []
|
|
16
16
|
@uuid = LogjamAgent.generate_uuid
|
|
17
|
-
@fields = initial_fields.merge(:request_id => @uuid, :host => LogjamAgent.hostname,
|
|
17
|
+
@fields = initial_fields.merge(:request_id => @uuid, :host => LogjamAgent.hostname,
|
|
18
|
+
:process_id => Process.pid, :lines => @lines)
|
|
19
|
+
if start_time = @fields.delete(:start_time)
|
|
20
|
+
self.start_time = start_time
|
|
21
|
+
end
|
|
18
22
|
@mutex = Mutex.new
|
|
19
23
|
@ignored = false
|
|
20
24
|
@bytes_all_lines = 0
|
|
@@ -22,6 +26,12 @@ module LogjamAgent
|
|
|
22
26
|
@max_line_length = LogjamAgent.max_line_length
|
|
23
27
|
end
|
|
24
28
|
|
|
29
|
+
def start_time=(start_time)
|
|
30
|
+
@start_time = start_time
|
|
31
|
+
@fields[:started_at] = start_time.iso8601
|
|
32
|
+
@fields[:started_ms] = start_time.tv_sec * 1000 + start_time.tv_usec / 1000
|
|
33
|
+
end
|
|
34
|
+
|
|
25
35
|
def ignore!
|
|
26
36
|
@ignored = true
|
|
27
37
|
end
|
data/lib/logjam_agent/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefan Kaes
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-01-
|
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|