request-tracer 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzMwYTk0ZmM5YTBhMjk3ZDY3YmMyMTgzZGI5MWIwNTJiOGU4OWE3Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGM2NjRhN2IzZDlmYzA5MjZkM2JiMmI4NWY0YzQ4MjY2MzI4M2M3Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjFlZjU3ZDhlOGZkMTI2YzU1MjI0OWVjYzNiZjk4YjI3ODllMjljYjAyNzM0
|
10
|
+
YzJmMmU1YTY5MDMyYzhmMzUzYmI3ZTY1OTI1MmJlMjA1ZWQ3OWZlNjY5Njhm
|
11
|
+
MzA2MzU3YjFkZmU1ZjhhY2NiZWMxYjZlYmM0YzllZGM2NmZkYzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTNmNWI1MWRiNTY4MjE3NTNhNGUyMjgzY2FlNzY0ZmZkNGQ3OWMyOTQ1Y2Fi
|
14
|
+
NjAwMWQ0NWFmNDNhMTVkNzgyYWUzY2Y1NWMwODU5ZDdmOTgyM2E2NmU5ZDY5
|
15
|
+
M2ExZjZhOTc3YWVkODdlMGUyOTViZDAwOTE4ZjU0ZTFhMDZhOGQ=
|
@@ -1,12 +1,6 @@
|
|
1
1
|
module RequestTracer
|
2
2
|
module Integration
|
3
3
|
module Base
|
4
|
-
B3_REQUIRED_FIELDS = %w(trace_id parent_span_id span_id)
|
5
|
-
B3_REQUIRED_FIELDS_FROM_SHORT_NAMES = B3_REQUIRED_FIELDS.map {|f| [f.gsub("_", ""), f] }.to_h
|
6
|
-
B3_REQUIRED_HEADERS = B3_REQUIRED_FIELDS.map {|f| "HTTP_X_B3_#{f.gsub("_", "").upcase}" }
|
7
|
-
B3_REQUIRED_FIELD_HEADER_MAP = B3_REQUIRED_FIELDS.zip(B3_REQUIRED_HEADERS).to_h
|
8
|
-
B3_REQUIRED_HEADER_FIELD_MAP = B3_REQUIRED_HEADERS.zip(B3_REQUIRED_FIELDS).to_h
|
9
|
-
B3_OPT_HEADERS = %w[HTTP_X_B3_FLAGS]
|
10
4
|
def extract_fields_from_headers(header_hash)
|
11
5
|
header_hash.map do |k,v|
|
12
6
|
special_header = /HTTP_X_B3_(.*)/.match(k)
|
data/lib/request_tracer.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
module RequestTracer
|
2
|
+
B3_REQUIRED_FIELDS = %w(trace_id parent_span_id span_id)
|
3
|
+
B3_REQUIRED_FIELDS_FROM_SHORT_NAMES = B3_REQUIRED_FIELDS.map {|f| [f.gsub("_", ""), f] }.to_h
|
4
|
+
B3_REQUIRED_HEADERS = B3_REQUIRED_FIELDS.map {|f| "HTTP_X_B3_#{f.gsub("_", "").upcase}" }
|
5
|
+
B3_REQUIRED_FIELD_HEADER_MAP = B3_REQUIRED_FIELDS.zip(B3_REQUIRED_HEADERS).to_h
|
6
|
+
B3_REQUIRED_HEADER_FIELD_MAP = B3_REQUIRED_HEADERS.zip(B3_REQUIRED_FIELDS).to_h
|
7
|
+
B3_OPT_HEADERS = %w[HTTP_X_B3_FLAGS]
|
8
|
+
|
2
9
|
def self.integrate_with(*services)
|
3
10
|
services.each do |service|
|
4
11
|
require_relative "request_tracer/integration/#{service}_handler"
|
@@ -37,7 +37,7 @@ describe RequestTracer::Integration::RackHandler do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
let(:trace_headers) { RequestTracer::
|
40
|
+
let(:trace_headers) { RequestTracer::B3_REQUIRED_HEADERS.map {|a| [a, rand(1000)] }.to_h }
|
41
41
|
context 'Zipkin headers are passed to the middleware' do
|
42
42
|
subject { middleware(service) }
|
43
43
|
it_behaves_like "traces the request"
|