zipkin-tracer 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/zipkin-tracer/faraday/zipkin-tracer.rb +12 -6
- data/lib/zipkin-tracer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmU3ZjM4OTBmOGM0NWRmMjkwNjkzZWY1MmE1ZWM5MWY4OTQ5OGQ3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzI1NmFiNTEzOGYwYTVlMzk4MDljZDIxYzE5ZGQxY2RmZTc3ZjdiMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjNlYTFjZDcyY2IwZDMxMjUwMjNhNzZhZGJmNjk4ODA0ZGIwNWQ2N2NlZDZm
|
10
|
+
ODViMmM1MmM5OWNhNmFlZjIwNzgxOTY4MDhiNjFkMTkxMGVjN2Q0OTQ1MjAx
|
11
|
+
YWM1YzY4Zjg0YjRhODI0NTUxZTdhZDdiMDY3YmRlZmE2MmU0MjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDEzMGRmNTBhZWRmYTc0YTc3NDllODkxMDExMWYzODQzMTgwZjg2MTAyNWQz
|
14
|
+
ZjFjYjVjMDAyNGI5NDM3NmNmZTQ4YWUyYmZkYTllYWMwZGNjZjBjZjdhYjgw
|
15
|
+
Nzc1MjM4MjkyY2RmNGFjOGE0OGRhMmFlODhjZmQ4ZGYwNzczYTg=
|
@@ -21,9 +21,9 @@ module ZipkinTracer
|
|
21
21
|
def call(env)
|
22
22
|
# handle either a URI object (passed by Faraday v0.8.x in testing), or something string-izable
|
23
23
|
url = env[:url].respond_to?(:host) ? env[:url] : URI.parse(env[:url].to_s)
|
24
|
-
|
24
|
+
local_endpoint = ::Trace.default_endpoint # The rack middleware set this up for us.
|
25
|
+
remote_endpoint = callee_endpoint(url) # The endpoint we are calling.
|
25
26
|
|
26
|
-
endpoint = ::Trace::Endpoint.new(host_ip_for(url.host), url.port, service_name)
|
27
27
|
response = nil
|
28
28
|
begin
|
29
29
|
trace_id = ::Trace.id
|
@@ -33,13 +33,14 @@ module ZipkinTracer
|
|
33
33
|
end
|
34
34
|
# annotate with method (GET/POST/etc.) and uri path
|
35
35
|
::Trace.set_rpc_name(env[:method].to_s.downcase)
|
36
|
-
record(::Trace::BinaryAnnotation.new("http.uri", url.path, "STRING",
|
37
|
-
record(::Trace::
|
36
|
+
record(::Trace::BinaryAnnotation.new("http.uri", url.path, "STRING", local_endpoint))
|
37
|
+
record(::Trace::BinaryAnnotation.new("sa", "1", "BOOL", remote_endpoint))
|
38
|
+
record(::Trace::Annotation.new(::Trace::Annotation::CLIENT_SEND, local_endpoint))
|
38
39
|
response = @app.call(env).on_complete do |renv|
|
39
40
|
# record HTTP status code on response
|
40
|
-
record(::Trace::BinaryAnnotation.new("http.status", renv[:status].to_s, "STRING",
|
41
|
+
record(::Trace::BinaryAnnotation.new("http.status", renv[:status].to_s, "STRING", local_endpoint))
|
41
42
|
end
|
42
|
-
record(::Trace::Annotation.new(::Trace::Annotation::CLIENT_RECV,
|
43
|
+
record(::Trace::Annotation.new(::Trace::Annotation::CLIENT_RECV, local_endpoint))
|
43
44
|
ensure
|
44
45
|
::Trace.pop
|
45
46
|
end
|
@@ -54,6 +55,11 @@ module ZipkinTracer
|
|
54
55
|
#TODO: if this class some day accepts a config hash, add a logger
|
55
56
|
end
|
56
57
|
|
58
|
+
def callee_endpoint(url)
|
59
|
+
service_name = @service_name || url.host.split('.').first || 'unknown' # default to url-derived service name
|
60
|
+
::Trace::Endpoint.new(host_ip_for(url.host), url.port, service_name)
|
61
|
+
end
|
62
|
+
|
57
63
|
# get host IP for specified hostname, catching exceptions
|
58
64
|
def host_ip_for(hostname)
|
59
65
|
::Trace::Endpoint.host_to_i32(hostname)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipkin-tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franklin Hu
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-11-
|
13
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: finagle-thrift
|