logjam_agent 0.32.4 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logjam_agent/middleware.rb +2 -0
- data/lib/logjam_agent/request.rb +5 -0
- data/lib/logjam_agent/version.rb +1 -1
- data/test/request_test.rb +10 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd400c4a9aedda3d5659a550bd2da21e9a29696cd1e5c77c14cb1f15d8e7e50
|
4
|
+
data.tar.gz: d71e179fd331b16c0b2117a31a15e45278477b8f4709ffaf93d91c2a859d9a44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5fbde19a0225c1859940ab1add7a690ef67109f861154e7a9d80bbc33834ae18fc415d1ab90ca891d7c245c20761c96ab92d07e99ca011ac5866a740ba37376
|
7
|
+
data.tar.gz: ff9c7d40001b7902f5fbccb8db57b32d57f23760e74225412be354d046967c97c7e0eafec4bc31b7cd2c961920d31fbc2645671091081e441100001ce82c1d40
|
@@ -50,9 +50,11 @@ module LogjamAgent
|
|
50
50
|
env_name = env["logjam_agent.environment_name"] || LogjamAgent.environment_name
|
51
51
|
caller_id = env["HTTP_X_LOGJAM_CALLER_ID"] || ""
|
52
52
|
caller_action = env["HTTP_X_LOGJAM_ACTION"] || ""
|
53
|
+
trace_id = env["HTTP_X_LOGJAM_TRACE_ID"] || ""
|
53
54
|
extra_fields = {}
|
54
55
|
extra_fields[:caller_id] = caller_id if caller_id.present?
|
55
56
|
extra_fields[:caller_action] = caller_action if caller_action.present?
|
57
|
+
extra_fields[:trace_id] = trace_id if trace_id.present?
|
56
58
|
LogjamAgent.start_request(app_name, env_name, extra_fields)
|
57
59
|
end
|
58
60
|
|
data/lib/logjam_agent/request.rb
CHANGED
@@ -17,6 +17,7 @@ module LogjamAgent
|
|
17
17
|
@uuid = LogjamAgent.generate_uuid
|
18
18
|
@fields = initial_fields.merge(:request_id => @uuid, :host => LogjamAgent.hostname,
|
19
19
|
:process_id => Process.pid, :lines => @lines)
|
20
|
+
@fields[:trace_id] ||= @uuid
|
20
21
|
unless (revision = LogjamAgent.application_revision).blank?
|
21
22
|
@fields[:revision] = revision
|
22
23
|
end
|
@@ -70,6 +71,10 @@ module LogjamAgent
|
|
70
71
|
@fields[:caller_action]
|
71
72
|
end
|
72
73
|
|
74
|
+
def trace_id
|
75
|
+
@fields[:trace_id]
|
76
|
+
end
|
77
|
+
|
73
78
|
def add_line(severity, timestamp, message)
|
74
79
|
@mutex.synchronize do
|
75
80
|
if @bytes_all_lines > @max_bytes_all_lines
|
data/lib/logjam_agent/version.rb
CHANGED
data/test/request_test.rb
CHANGED
@@ -44,6 +44,16 @@ module LogjamAgent
|
|
44
44
|
assert_equal TRUNCATED_LINE, lines(@request)[1][2]
|
45
45
|
end
|
46
46
|
|
47
|
+
def test_sets_trace_id_to_request_id_if_not_passed_in
|
48
|
+
assert_equal @request.uuid, @request.fields[:trace_id]
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_sets_trace_id_to_passed_in_field_value
|
52
|
+
trace_id = "murks"
|
53
|
+
request = Request.new("app", "env", {trace_id: trace_id})
|
54
|
+
assert_equal trace_id, request.fields[:trace_id]
|
55
|
+
end
|
56
|
+
|
47
57
|
private
|
48
58
|
|
49
59
|
def lines(request)
|
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.33.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: 2021-
|
11
|
+
date: 2021-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -275,16 +275,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
- !ruby/object:Gem::Version
|
276
276
|
version: '0'
|
277
277
|
requirements: []
|
278
|
-
rubygems_version: 3.2.
|
278
|
+
rubygems_version: 3.2.24
|
279
279
|
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: Logjam client library to be used with logjam
|
282
282
|
test_files:
|
283
|
+
- test/request_test.rb
|
283
284
|
- test/sinatra_app.rb
|
284
|
-
- test/sinatra_classic_test.rb
|
285
285
|
- test/sinatra_classic_app.rb
|
286
|
-
- test/
|
287
|
-
- test/zmq_forwarder_test.rb
|
288
|
-
- test/util_test.rb
|
289
|
-
- test/test_helper.rb
|
286
|
+
- test/sinatra_classic_test.rb
|
290
287
|
- test/sinatra_test.rb
|
288
|
+
- test/test_helper.rb
|
289
|
+
- test/util_test.rb
|
290
|
+
- test/zmq_forwarder_test.rb
|