moesif_rack 1.2.4 → 1.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c3bc23b2a630c3e5d3e94a079051987eb36a54615f31782a32086a9e0193a18
4
- data.tar.gz: 53b4260776341503fb558eaf83adf17973b6a34c1f072c94efa760334c5bad8f
3
+ metadata.gz: 9204370515cc07a90a131af8026d143f8fb666f45fc487b10b3bf21579cc20d9
4
+ data.tar.gz: 2de61defa7298cd0c70e0a453e3b12242dd249f26334569d326f5e7ab257ea11
5
5
  SHA512:
6
- metadata.gz: 7a9c4618fc436a2e21c8b4b96ee2f171827a4a56c178f6baa617677321635b8f083b70d7bb0c27f0c25d486f7560730e63d71814b27feb9403f46c60df0e4370
7
- data.tar.gz: d3a6f7872f830dd083972872202f2de6f978f076779383d380e66e0948806b43a56cc3da54aa11c6e70abdbba2e3a28997ce1442f574320f8169916fcbbed03e
6
+ metadata.gz: b1f00c41d71b23c436aeab707803af8f8e6e39931560e3179ce7838aeeca121599048a46e936051b4a721499a876c1a5626cad72e78fe0ce034105aa53f15d5f
7
+ data.tar.gz: b39d08f502436c211ad9851d927395e333a8ef4bd218ff4506aac9386d19fbe165ab15bd2f68d7f6b2df8e5b90353e6cd5c05d7b1e27dae8e22c6a05f57eaddc
data/README.md CHANGED
@@ -20,7 +20,7 @@ gem install moesif_rack
20
20
  and if you have a `Gemfile` in your project, please add this line to
21
21
 
22
22
  ```
23
- gem 'moesif_rack', '~> 1.2.4'
23
+ gem 'moesif_rack', '~> 1.2.5'
24
24
 
25
25
  ```
26
26
 
@@ -22,6 +22,7 @@ module MoesifRack
22
22
  @skip = options['skip']
23
23
  @debug = options['debug']
24
24
  @config_dict = Hash.new
25
+ @disable_transaction_id = options['disable_transaction_id'] || false
25
26
  @sampling_percentage = get_config(nil)
26
27
  if not @sampling_percentage.is_a? Numeric
27
28
  raise "Sampling Percentage should be a number"
@@ -113,6 +114,34 @@ module MoesifRack
113
114
  if @api_version
114
115
  event_req.api_version = @api_version
115
116
  end
117
+
118
+ # Add Transaction Id to the Request Header
119
+ if !@disable_transaction_id
120
+ req_trans_id = req_headers["X-MOESIF_TRANSACTION_ID"]
121
+ if !req_trans_id.nil?
122
+ transaction_id = req_trans_id
123
+ if transaction_id.strip.empty?
124
+ transaction_id = SecureRandom.uuid
125
+ end
126
+ else
127
+ transaction_id = SecureRandom.uuid
128
+ end
129
+ # Add Transaction Id to Request Header
130
+ req_headers["X-Moesif-Transaction-Id"] = transaction_id
131
+ # Filter out the old key as HTTP Headers case are not preserved
132
+ req_headers = req_headers.except("X-MOESIF_TRANSACTION_ID")
133
+ end
134
+
135
+ # Add Transaction Id to the Response Header
136
+ if !transaction_id.nil?
137
+ rsp_headers["X-Moesif-Transaction-Id"] = transaction_id
138
+ end
139
+
140
+ # Add Transaction Id to the Repsonse Header sent to the client
141
+ if !transaction_id.nil?
142
+ headers["X-Moesif-Transaction-Id"] = transaction_id
143
+ end
144
+
116
145
  event_req.ip_address = req.ip
117
146
  event_req.headers = req_headers
118
147
  event_req.body = req_body
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moesif_rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moesif, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-21 00:00:00.000000000 Z
12
+ date: 2019-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -68,7 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubygems_version: 3.0.1
71
+ rubyforge_project:
72
+ rubygems_version: 2.7.7
72
73
  signing_key:
73
74
  specification_version: 4
74
75
  summary: moesif_rack