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 +4 -4
- data/README.md +1 -1
- data/lib/moesif_rack/moesif_middleware.rb +29 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9204370515cc07a90a131af8026d143f8fb666f45fc487b10b3bf21579cc20d9
|
4
|
+
data.tar.gz: 2de61defa7298cd0c70e0a453e3b12242dd249f26334569d326f5e7ab257ea11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1f00c41d71b23c436aeab707803af8f8e6e39931560e3179ce7838aeeca121599048a46e936051b4a721499a876c1a5626cad72e78fe0ce034105aa53f15d5f
|
7
|
+
data.tar.gz: b39d08f502436c211ad9851d927395e333a8ef4bd218ff4506aac9386d19fbe165ab15bd2f68d7f6b2df8e5b90353e6cd5c05d7b1e27dae8e22c6a05f57eaddc
|
data/README.md
CHANGED
@@ -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
|
+
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
|
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
|
-
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 2.7.7
|
72
73
|
signing_key:
|
73
74
|
specification_version: 4
|
74
75
|
summary: moesif_rack
|