rack-tracer 0.6.0 → 0.7.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: 7a5669fdb260f9f92c7d6b807bd55bd4ac3a1560
4
- data.tar.gz: 8682a3f0904f69efd5f3f3a6af4af9f170dd9150
3
+ metadata.gz: 14e847fe82d881c1a45f7980c3f2b5e7e440f9a8
4
+ data.tar.gz: 1b12ffdbef6149a5f0ccb469367c0682e28d9a53
5
5
  SHA512:
6
- metadata.gz: 4db8628c41fb256fa56d2a949abdc2e499c183f2a73d56ee1aff640e9308ee703272bcdaed058917b0cb07df83297f31c22daaa93ef18b7404bdf08a3df540df
7
- data.tar.gz: '0900be47a4c70cad280587b92387ae5b46e220805d0d656edce7e7ff37f57599ca9f657466a7d3fdcf819aa11b2885b046a140823ad37ca1c8c4415b6dd25082'
6
+ metadata.gz: 3b5a2f9c86e512e712f5ee07b130b1ec5b4a1f6dc0de05886dc201ff392c35f92b54c70e1413072ed2c7a8225b58c5d8293062dcaed4909e4b57da82ffecd8fe
7
+ data.tar.gz: 0c0c5e0084d26ed366d9d31c7803ba82cb4c2a41ee0b0902a2887dfd2af22afe8c2c026ae6cecf79075d4e2f1ee9101f0bfabfac35992d7ae1ca557dbf402c7b
data/.rubocop.yml CHANGED
@@ -20,3 +20,9 @@ RSpec/ExampleLength:
20
20
 
21
21
  RSpec/MultipleExpectations:
22
22
  Enabled: no
23
+
24
+ Style/FrozenStringLiteralComment:
25
+ Enabled: yes
26
+ EnforcedStyle: always
27
+ Include:
28
+ - 'lib/**/*'
data/README.md CHANGED
@@ -23,11 +23,17 @@ You can access the created span using
23
23
  env['rack.span']
24
24
  ```
25
25
 
26
+ or you can use
27
+ ```ruby
28
+ OpenTracing.active_span
29
+ ```
30
+ See [opentracing-ruby](https://github.com/opentracing/opentracing-ruby) for more information how active_span works and what are its limitations.
31
+
26
32
  You can also add start and finish span callbacks
27
33
  ```ruby
28
34
  use Rack::Tracer,
29
- on_start_span: ->(span) { Thread.current[:root_span] = span },
30
- on_finish_span: ->(_span) { Thread.current[:root_span] = nil }
35
+ on_start_span: ->(span) { do_something(span) },
36
+ on_finish_span: ->(_span) { do_something(span) }
31
37
  ```
32
38
 
33
39
  ## Development
data/lib/rack/tracer.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'opentracing'
2
4
 
3
5
  module Rack
@@ -32,7 +34,7 @@ module Rack
32
34
  method = env[REQUEST_METHOD]
33
35
 
34
36
  context = @tracer.extract(OpenTracing::FORMAT_RACK, env) if @trust_incoming_span
35
- span = @tracer.start_span(
37
+ scope = @tracer.start_active_span(
36
38
  method,
37
39
  child_of: context,
38
40
  tags: {
@@ -43,6 +45,7 @@ module Rack
43
45
  'http.uri' => env[REQUEST_URI] # For zipkin, not OT convention
44
46
  }
45
47
  )
48
+ span = scope.span
46
49
 
47
50
  @on_start_span.call(span) if @on_start_span
48
51
 
@@ -66,7 +69,7 @@ module Rack
66
69
  raise
67
70
  ensure
68
71
  begin
69
- span.finish
72
+ scope.close
70
73
  ensure
71
74
  @on_finish_span.call(span) if @on_finish_span
72
75
  end
data/rack-tracer.gemspec CHANGED
@@ -1,10 +1,9 @@
1
-
2
1
  lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
 
5
4
  Gem::Specification.new do |spec|
6
5
  spec.name = 'rack-tracer'
7
- spec.version = '0.6.0'
6
+ spec.version = '0.7.0'
8
7
  spec.authors = ['SaleMove TechMovers']
9
8
  spec.email = ['techmovers@salemove.com']
10
9
 
@@ -18,14 +17,13 @@ Gem::Specification.new do |spec|
18
17
  end
19
18
  spec.require_paths = ['lib']
20
19
 
21
- spec.add_dependency 'opentracing'
20
+ spec.add_dependency 'opentracing', '~> 0.4'
22
21
 
23
22
  spec.add_development_dependency 'bundler', '~> 1.14'
23
+ spec.add_development_dependency 'opentracing_test_tracer', '~> 0.1'
24
24
  spec.add_development_dependency 'rack', '~> 2.0'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
27
  spec.add_development_dependency 'rubocop', '~> 0.54.0'
28
28
  spec.add_development_dependency 'rubocop-rspec', '~> 1.24.0'
29
- spec.add_development_dependency 'test-tracer', '~> 1.0'
30
- spec.add_development_dependency 'tracing-matchers', '~> 1.0'
31
29
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.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: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentracing
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: opentracing_test_tracer
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rack
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,34 +122,6 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: 1.24.0
111
- - !ruby/object:Gem::Dependency
112
- name: test-tracer
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.0'
125
- - !ruby/object:Gem::Dependency
126
- name: tracing-matchers
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '1.0'
139
125
  description: ''
140
126
  email:
141
127
  - techmovers@salemove.com