rack-tracer 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: 25020dc3f136467fdcb4f6ecb31c1261ea1d0c63
4
- data.tar.gz: 5feb8c25bd234a1c9dcf772664a30eae71db0616
3
+ metadata.gz: d2e0206b695f4535e4b24bc2ab7d4b64bd4ebe7a
4
+ data.tar.gz: 8677a213cd12b4301865aa133acc1674bac2fbec
5
5
  SHA512:
6
- metadata.gz: eb33aaceaa3ffafd333cb22c717eef1be01fbb858588fe8cf2f8a456417235c9d1841e1ca02162d6df09718c39f8faaa9b788b390949ec424d14bacd2fba6732
7
- data.tar.gz: ea1da1cc76be2c31a3d3e4b4ea64cec2d8f303f7fc68c13c94b221aba84dedc31ab61ff0ca071d67a9c6020088e4b570683b1afc1865a980e07c5bee0a513eb1
6
+ metadata.gz: 23513f5236389f12b3ea82a237ee66dde762a9a5fe75d5a91115e0eea181d772e985f8a6407ed527e104c6665dfd3411f3f9d83f2c49bbc39137c535fa4873db
7
+ data.tar.gz: af8418667700628ca8a346cf5f883a7d775e4d081a1b483c38521b626ada6906a6d80c1f1a8b42ec0cab5fa88a8c6f76ad0afad4aa22851505e3d0e4c9639f7a
data/README.md CHANGED
@@ -16,6 +16,17 @@ OpenTracing.global_tracer = TracerImplementation.new
16
16
 
17
17
  require 'rack/tracer'
18
18
  use Rack::Tracer
19
+ ```
20
+
21
+ You can access the created span using
22
+ ```ruby
23
+ env['rack.span']
24
+ ```
25
+
26
+ You can also add a start span callback
27
+ ```ruby
28
+ use Rack::Tracer, on_start_span: Proc.new {|span| do_something(span) }
29
+ ```
19
30
 
20
31
  ## Development
21
32
 
data/lib/rack/tracer.rb CHANGED
@@ -5,9 +5,10 @@ module Rack
5
5
  REQUEST_URI = 'REQUEST_URI'.freeze
6
6
  REQUEST_METHOD = 'REQUEST_METHOD'.freeze
7
7
 
8
- def initialize(app, tracer = OpenTracing.global_tracer)
8
+ def initialize(app, tracer: OpenTracing.global_tracer, on_start_span: nil)
9
9
  @app = app
10
10
  @tracer = tracer
11
+ @on_start_span = on_start_span
11
12
  end
12
13
 
13
14
  def call(env)
@@ -25,6 +26,10 @@ module Rack
25
26
  }
26
27
  )
27
28
 
29
+ if @on_start_span
30
+ @on_start_span.call(span)
31
+ end
32
+
28
33
  env['rack.span'] = span
29
34
 
30
35
  @app.call(env).tap do |status_code, _headers, _body|
data/rack-tracer.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'rack-tracer'
7
- spec.version = '0.1.0'
7
+ spec.version = '0.2.0'
8
8
  spec.authors = ['SaleMove TechMovers']
9
9
  spec.email = ['techmovers@salemove.com']
10
10
 
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency 'bundler', '~> 1.14'
24
24
  spec.add_development_dependency 'rake', '~> 10.0'
25
25
  spec.add_development_dependency 'rspec', '~> 3.0'
26
- spec.add_development_dependency 'logasm-tracer', '~> 0.2.0'
26
+ spec.add_development_dependency 'logasm-tracer', '~> 0.2.1'
27
27
  spec.add_development_dependency 'rack', '~> 2.0'
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaleMove TechMovers
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.0
75
+ version: 0.2.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.0
82
+ version: 0.2.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rack
85
85
  requirement: !ruby/object:Gem::Requirement