rack-tracer 0.5.0 → 0.6.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: fcdf093205910aa4ebbf86106ae6929cb357dea6
4
- data.tar.gz: 05b02d43b23d13608c6290dca697314c13a389fa
3
+ metadata.gz: 7a5669fdb260f9f92c7d6b807bd55bd4ac3a1560
4
+ data.tar.gz: 8682a3f0904f69efd5f3f3a6af4af9f170dd9150
5
5
  SHA512:
6
- metadata.gz: 4b6ca1127b3e86a814e99dd243c059ba282696dfa878e873c9930a43b036ec0f7ff23df63981248ce3cfacaa622d8ce2895aaaad38c75d3412ed3d9461fe0292
7
- data.tar.gz: e04d7645b819e853ca9cde4b25dd2121aca8717ef20bc85a9457fb8a05f3724b16cd1987c558633bcea6275b54b3e356a2ec64f62e0aa714d867267b375f0704
6
+ metadata.gz: 4db8628c41fb256fa56d2a949abdc2e499c183f2a73d56ee1aff640e9308ee703272bcdaed058917b0cb07df83297f31c22daaa93ef18b7404bdf08a3df540df
7
+ data.tar.gz: '0900be47a4c70cad280587b92387ae5b46e220805d0d656edce7e7ff37f57599ca9f657466a7d3fdcf819aa11b2885b046a140823ad37ca1c8c4415b6dd25082'
@@ -0,0 +1,22 @@
1
+ require: rubocop-rspec
2
+
3
+ Metrics/AbcSize:
4
+ Enabled: no
5
+
6
+ Metrics/BlockLength:
7
+ Enabled: no
8
+
9
+ Metrics/LineLength:
10
+ Max: 120
11
+
12
+ Metrics/MethodLength:
13
+ Enabled: no
14
+
15
+ Style/Documentation:
16
+ Enabled: no
17
+
18
+ RSpec/ExampleLength:
19
+ Enabled: no
20
+
21
+ RSpec/MultipleExpectations:
22
+ Enabled: no
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task :default => :spec
7
+ RuboCop::RakeTask.new(:rubocop)
8
+
9
+ task default: %i[rubocop spec]
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "rack/tracer"
3
+ require 'bundler/setup'
4
+ require 'rack/tracer'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "rack/tracer"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -14,7 +14,12 @@ module Rack
14
14
  # @param on_finish_span [Proc, nil] A callback evaluated after a span is finished.
15
15
  # @param errors [Array<Class>] An array of error classes to be captured by the tracer
16
16
  # as errors. Errors are **not** muted by the middleware, they're re-raised afterwards.
17
- def initialize(app, tracer: OpenTracing.global_tracer, on_start_span: nil, on_finish_span: nil, trust_incoming_span: true, errors: [StandardError])
17
+ def initialize(app, # rubocop:disable Metrics/ParameterLists
18
+ tracer: OpenTracing.global_tracer,
19
+ on_start_span: nil,
20
+ on_finish_span: nil,
21
+ trust_incoming_span: true,
22
+ errors: [StandardError])
18
23
  @app = app
19
24
  @tracer = tracer
20
25
  @on_start_span = on_start_span
@@ -27,7 +32,8 @@ module Rack
27
32
  method = env[REQUEST_METHOD]
28
33
 
29
34
  context = @tracer.extract(OpenTracing::FORMAT_RACK, env) if @trust_incoming_span
30
- span = @tracer.start_span(method,
35
+ span = @tracer.start_span(
36
+ method,
31
37
  child_of: context,
32
38
  tags: {
33
39
  'component' => 'rack',
@@ -45,13 +51,18 @@ module Rack
45
51
  @app.call(env).tap do |status_code, _headers, _body|
46
52
  span.set_tag('http.status_code', status_code)
47
53
 
48
- if route = route_from_env(env)
49
- span.set_tag('route', route)
50
- end
54
+ route = route_from_env(env)
55
+ span.set_tag('route', route) if route
51
56
  end
52
57
  rescue *@errors => e
53
58
  span.set_tag('error', true)
54
- span.log(event: 'error', :'error.object' => e)
59
+ span.log_kv(
60
+ event: 'error',
61
+ :'error.kind' => e.class.to_s,
62
+ :'error.object' => e,
63
+ message: e.message,
64
+ stack: e.backtrace.join("\n")
65
+ )
55
66
  raise
56
67
  ensure
57
68
  begin
@@ -64,9 +75,8 @@ module Rack
64
75
  private
65
76
 
66
77
  def route_from_env(env)
67
- if route = env['sinatra.route']
68
- route.split(' ').last
69
- end
78
+ route = env['sinatra.route']
79
+ route.split(' ').last if route
70
80
  end
71
81
  end
72
82
  end
@@ -1,15 +1,15 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+
2
+ lib = File.expand_path('lib', __dir__)
3
3
  $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.5.0'
7
+ spec.version = '0.6.0'
8
8
  spec.authors = ['SaleMove TechMovers']
9
9
  spec.email = ['techmovers@salemove.com']
10
10
 
11
- spec.summary = %q{Rack OpenTracing middleware}
12
- spec.description = %q{}
11
+ spec.summary = 'Rack OpenTracing middleware'
12
+ spec.description = ''
13
13
  spec.homepage = 'https://github.com/opentracing-contrib/ruby-rack-tracer'
14
14
  spec.license = 'MIT'
15
15
 
@@ -21,8 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'opentracing'
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1.14'
24
+ spec.add_development_dependency 'rack', '~> 2.0'
24
25
  spec.add_development_dependency 'rake', '~> 10.0'
25
26
  spec.add_development_dependency 'rspec', '~> 3.0'
26
- spec.add_development_dependency 'logasm-tracer', '~> 0.2.1'
27
- spec.add_development_dependency 'rack', '~> 2.0'
27
+ spec.add_development_dependency 'rubocop', '~> 0.54.0'
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'
28
31
  end
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.5.0
4
+ version: 0.6.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-04-09 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentracing
@@ -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: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,33 +81,61 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '3.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: logasm-tracer
84
+ name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.2.1
89
+ version: 0.54.0
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.2.1
96
+ version: 0.54.0
83
97
  - !ruby/object:Gem::Dependency
84
- name: rack
98
+ name: rubocop-rspec
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '2.0'
103
+ version: 1.24.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '2.0'
110
+ 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'
97
139
  description: ''
98
140
  email:
99
141
  - techmovers@salemove.com
@@ -103,6 +145,7 @@ extra_rdoc_files: []
103
145
  files:
104
146
  - ".gitignore"
105
147
  - ".rspec"
148
+ - ".rubocop.yml"
106
149
  - ".travis.yml"
107
150
  - Gemfile
108
151
  - LICENSE.txt