zipkin-tracer 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zipkin-tracer/application.rb +12 -1
- data/lib/zipkin-tracer/rack/zipkin-tracer.rb +10 -2
- data/lib/zipkin-tracer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d0f7baf3534a37de98d27ccd678779af53c2f52f6aa52fde0d9548cadbde6a5
|
4
|
+
data.tar.gz: c767d904d684b2f677c7ae07f135a721bbfa991a147a8336bc88c29300244a91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5255f87800237b75b28c0d4e67cde83baa98b83d8b3123ad451775b482bcd63b8d776bd0299b232791e8f430fbdb0606daa2daa57903bb84ca203c0805c4ad7d
|
7
|
+
data.tar.gz: bb5edfd77651c8cd6707de0a1858c9849c1b367c49c28f1fd37cdf3c21d59bec3f42d8e3262cf1f9ef688bca55075dcc629ab393eaa91f574fa71dab6c921ec6
|
@@ -11,8 +11,19 @@ module ZipkinTracer
|
|
11
11
|
false
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.get_route(env)
|
15
|
+
return nil unless defined?(Rails)
|
16
|
+
req = Rack::Request.new(env)
|
17
|
+
# Returns a string like /some/path/:id
|
18
|
+
Rails.application.routes.router.recognize(req) do |route|
|
19
|
+
return route.path.spec.to_s
|
20
|
+
end
|
21
|
+
rescue
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
14
25
|
def self.logger
|
15
|
-
if defined?(Rails) # If we happen to be inside a Rails app, use its logger
|
26
|
+
if defined?(Rails.logger) # If we happen to be inside a Rails app, use its logger
|
16
27
|
Rails.logger
|
17
28
|
else
|
18
29
|
Logger.new(STDOUT)
|
@@ -30,7 +30,7 @@ module ZipkinTracer
|
|
30
30
|
if !trace_id.sampled? || !routable_request?(env)
|
31
31
|
@app.call(env)
|
32
32
|
else
|
33
|
-
@tracer.with_new_span(trace_id, env
|
33
|
+
@tracer.with_new_span(trace_id, span_name(env)) do |span|
|
34
34
|
trace!(span, zipkin_env) { @app.call(env) }
|
35
35
|
end
|
36
36
|
end
|
@@ -40,7 +40,15 @@ module ZipkinTracer
|
|
40
40
|
private
|
41
41
|
|
42
42
|
def routable_request?(env)
|
43
|
-
Application.routable_request?(env[PATH_INFO],
|
43
|
+
Application.routable_request?(env[PATH_INFO], env[REQUEST_METHOD])
|
44
|
+
end
|
45
|
+
|
46
|
+
def route(env)
|
47
|
+
Application.get_route(env)
|
48
|
+
end
|
49
|
+
|
50
|
+
def span_name(env)
|
51
|
+
"#{env[REQUEST_METHOD].to_s.downcase} #{route(env)}".strip
|
44
52
|
end
|
45
53
|
|
46
54
|
def annotate_plugin(span, env, status, response_headers, response_body)
|
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.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franklin Hu
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-
|
16
|
+
date: 2018-09-11 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: faraday
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: 1.3.5
|
208
208
|
requirements: []
|
209
209
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.7.
|
210
|
+
rubygems_version: 2.7.7
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Ruby tracing via Zipkin
|