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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 882e0807f2b78aa878d7af652e4cb3ab6d0a77115e2add1792fc85091c629d15
4
- data.tar.gz: 0500627f55dd0c1e10013db3e2cdba1c23f15b587d3ceb440fe2bd0921cd3a2e
3
+ metadata.gz: dbd400c4a9aedda3d5659a550bd2da21e9a29696cd1e5c77c14cb1f15d8e7e50
4
+ data.tar.gz: d71e179fd331b16c0b2117a31a15e45278477b8f4709ffaf93d91c2a859d9a44
5
5
  SHA512:
6
- metadata.gz: f37a0ce94d7a2cc233eb5ff2c9a84c39b2396b1c99a0349df185bae8716e46b24caf8e6d341bca6ed503914721b59142ee7db2221ada9d3c7a544c86648b80f8
7
- data.tar.gz: d8c839977ec58a66e87381ca1cb76877988eacde9eaf59f7d4b2d102848c11c84ddc370c14bb1b0c559c1dab8e9a718de82a24d68982c61b94a49a69acd86fda
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.32.4"
2
+ VERSION = "0.33.0"
3
3
  end
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.32.4
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-02-25 00:00:00.000000000 Z
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.7
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/request_test.rb
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