rack-instruments 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rack/instruments.rb +9 -3
  2. metadata +1 -1
@@ -25,11 +25,18 @@ module Rack
25
25
  env["REQUEST_PATH"] =~ /\.#{ext}$/
26
26
  }
27
27
 
28
- request_ids = [@request_id_generator.call] + extract_request_ids(env)
28
+ request_ids = [@request_id_generator.call]
29
29
  status, headers, response = nil, nil, nil
30
30
 
31
31
  # make ID of the request accessible to consumers down the stack
32
- env["REQUEST_ID"] = request_ids
32
+ env["REQUEST_ID"] = request_ids[0]
33
+
34
+ # Extract request IDs from incoming headers as well. Can be used for
35
+ # identifying a request across a number of components in SOA.
36
+ if @header_request_ids
37
+ request_ids += extract_request_ids(env)
38
+ env["REQUEST_IDS"] = request_ids
39
+ end
33
40
 
34
41
  data = [
35
42
  [:method, env["REQUEST_METHOD"]],
@@ -51,7 +58,6 @@ module Rack
51
58
  private
52
59
 
53
60
  def extract_request_ids(env)
54
- return [] unless @header_request_ids
55
61
  request_ids = []
56
62
  if env["HTTP_REQUEST_ID"]
57
63
  request_ids = env["HTTP_REQUEST_ID"].split(",")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-instruments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: