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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fd814c00e7d43bd9fbd4678181407182904b369759f480c4334060f0de76a7b
4
- data.tar.gz: 207b8aba87d59166639646babb7c86d174a9880bca955e0e4a3e7d67ed40f49c
3
+ metadata.gz: 0d0f7baf3534a37de98d27ccd678779af53c2f52f6aa52fde0d9548cadbde6a5
4
+ data.tar.gz: c767d904d684b2f677c7ae07f135a721bbfa991a147a8336bc88c29300244a91
5
5
  SHA512:
6
- metadata.gz: bd5ff092a5b46f170a6978cdf5e88c2239e35abafb7b7c8d00a29cf9eaa007549dc18a15eb4e3172ec3152e4a2a12d589173e42f7d7fc405384defd8505ea6b2
7
- data.tar.gz: f9fece44e302cac6ede9a0023b5ab68683bef98cd300bc978998d403d9a8f528068c4f184fb3e69dcb4fae1c22bf5f47f26b7e6749bf2bba09a3c47df1445300
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[REQUEST_METHOD].to_s.downcase) do |span|
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], env[REQUEST_METHOD])
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)
@@ -1,3 +1,3 @@
1
1
  module ZipkinTracer
2
- VERSION = '0.28.0'.freeze
2
+ VERSION = '0.29.0'.freeze
3
3
  end
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.28.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-05-15 00:00:00.000000000 Z
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.6
210
+ rubygems_version: 2.7.7
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Ruby tracing via Zipkin