rack-tracer 0.2.0 → 0.3.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: d2e0206b695f4535e4b24bc2ab7d4b64bd4ebe7a
4
- data.tar.gz: 8677a213cd12b4301865aa133acc1674bac2fbec
3
+ metadata.gz: 5d2df76757764d23128ea4fdbc3843878700bfe3
4
+ data.tar.gz: 5c433caea14237f01968aa8d1d9d457758128ecf
5
5
  SHA512:
6
- metadata.gz: 23513f5236389f12b3ea82a237ee66dde762a9a5fe75d5a91115e0eea181d772e985f8a6407ed527e104c6665dfd3411f3f9d83f2c49bbc39137c535fa4873db
7
- data.tar.gz: af8418667700628ca8a346cf5f883a7d775e4d081a1b483c38521b626ada6906a6d80c1f1a8b42ec0cab5fa88a8c6f76ad0afad4aa22851505e3d0e4c9639f7a
6
+ metadata.gz: 301efdd66dc666f3c540ea8575367c1cc0e6a8bbebd569bdb52a9428821aa66a27a79af33ff7ca4e28fcec481c183134832314e27e45da366d0cfcc25bf122d2
7
+ data.tar.gz: 6f27e177f89899cb0649c520f192aaa48b92824bab09473771da08b81813817d8876297eddb7b30e236996c74e2b94d1e4a6c03f0f731acc276462be1d3a5d15
data/README.md CHANGED
@@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
36
36
 
37
37
  ## Contributing
38
38
 
39
- Bug reports and pull requests are welcome on GitHub at https://github.com/salemove/rack-tracer.
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/opentracing-contrib/ruby-rack-tracer.
40
40
 
41
41
 
42
42
  ## License
@@ -5,10 +5,19 @@ 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, on_start_span: nil)
8
+ # Create a new Rack Tracer middleware.
9
+ #
10
+ # @param app The Rack application/middlewares stack.
11
+ # @param tracer [OpenTracing::Tracer] A tracer to be used when start_span, and extract
12
+ # is called.
13
+ # @param on_start_span [Proc, nil] A callback evaluated after a new span is created.
14
+ # @param errors [Array<Class>] An array of error classes to be captured by the tracer
15
+ # as errors. Errors are **not** muted by the middleware, they're re-raised afterwards.
16
+ def initialize(app, tracer: OpenTracing.global_tracer, on_start_span: nil, errors: [StandardError])
9
17
  @app = app
10
18
  @tracer = tracer
11
19
  @on_start_span = on_start_span
20
+ @errors = errors
12
21
  end
13
22
 
14
23
  def call(env)
@@ -39,6 +48,10 @@ module Rack
39
48
  span.set_tag('route', route)
40
49
  end
41
50
  end
51
+ rescue *@errors => e
52
+ span.set_tag('error', true)
53
+ span.log(event: 'error', :'error.object' => e)
54
+ raise
42
55
  ensure
43
56
  span.finish
44
57
  end
@@ -4,13 +4,13 @@ $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.2.0'
7
+ spec.version = '0.3.0'
8
8
  spec.authors = ['SaleMove TechMovers']
9
9
  spec.email = ['techmovers@salemove.com']
10
10
 
11
11
  spec.summary = %q{Rack OpenTracing middleware}
12
12
  spec.description = %q{}
13
- spec.homepage = 'https://github.com/salemove/rack-tracer'
13
+ spec.homepage = 'https://github.com/opentracing-contrib/ruby-rack-tracer'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaleMove TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2017-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentracing
@@ -112,7 +112,7 @@ files:
112
112
  - bin/setup
113
113
  - lib/rack/tracer.rb
114
114
  - rack-tracer.gemspec
115
- homepage: https://github.com/salemove/rack-tracer
115
+ homepage: https://github.com/opentracing-contrib/ruby-rack-tracer
116
116
  licenses:
117
117
  - MIT
118
118
  metadata: {}
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.6.8
135
+ rubygems_version: 2.6.11
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Rack OpenTracing middleware