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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjUyNDUwMDA3Y2YxZjFmZWU2ZmIzYTViMjc5OGRkNjdlM2I0ZWQwZQ==
4
+ ZmU3ZjM4OTBmOGM0NWRmMjkwNjkzZWY1MmE1ZWM5MWY4OTQ5OGQ3Yw==
5
5
  data.tar.gz: !binary |-
6
- ZTVkYTUwYjkyMzVkM2NhZTNjYWQ2NDYyODVmN2I3NTMyMzE1Yjc4NQ==
6
+ MzI1NmFiNTEzOGYwYTVlMzk4MDljZDIxYzE5ZGQxY2RmZTc3ZjdiMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTE0YjZkMmVjMDc4ZmNmYWMwNzNkOTEzMzE5Yzk2ZmI3NDlhZmJhNjQyNWE4
10
- YjBlYzVkYmUxMmQwNGEzYzcxMWQzNWQzZDc2M2MwYzgyZTNhMTgwMjAyNWQ0
11
- OGM1NGYyNTM0ZGQ2MzIxMDRhOTU1NTY5NWVkZjlkYzU1N2UzNjg=
9
+ YjNlYTFjZDcyY2IwZDMxMjUwMjNhNzZhZGJmNjk4ODA0ZGIwNWQ2N2NlZDZm
10
+ ODViMmM1MmM5OWNhNmFlZjIwNzgxOTY4MDhiNjFkMTkxMGVjN2Q0OTQ1MjAx
11
+ YWM1YzY4Zjg0YjRhODI0NTUxZTdhZDdiMDY3YmRlZmE2MmU0MjU=
12
12
  data.tar.gz: !binary |-
13
- OTZkZjljOTAxMDA4YzFkM2YxNzhjZmVkMWZlYWU3ZDY4ZGFiODhkZTAwNTM3
14
- ZTc5NzA3NjdjYjhlZGMyNGUwZTZjZjJmYzNjYTQ5MjVkNTU2ZTRkZDNkNDRh
15
- ODNiNzgzNTJiMDVkZjlkNTZiNGEzMjczMGZiZjFiN2JlNTk2Yzk=
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
- service_name = @service_name || url.host.split('.').first # default to url-derived service name
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", endpoint))
37
- record(::Trace::Annotation.new(::Trace::Annotation::CLIENT_SEND, endpoint))
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", endpoint))
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, endpoint))
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)
@@ -12,6 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  module ZipkinTracer
15
- VERSION = "0.7.3"
15
+ VERSION = "0.8.0"
16
16
  end
17
17
 
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.7.3
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-09 00:00:00.000000000 Z
13
+ date: 2015-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: finagle-thrift