rack-instrumentation 0.1.0.pre → 0.1.0.pre2

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: f316ead3113e6157837293e94c50dc528466f27ee8983b8911f8630ce71f783d
4
- data.tar.gz: 5a47543c79961dc0b2ef7af9f6ec7b3b7e390a160f34308898fdcf2f14a748cc
3
+ metadata.gz: 43576358d3b5c78c10dc0bc3143897a0f4fdc3020e94585e5200cd9601616e22
4
+ data.tar.gz: 0ae639fbc6acce667e4e80122fda384b19a87bd19532badfb397cc2bda57c901
5
5
  SHA512:
6
- metadata.gz: b9c23714e2f2444d4c005f272ecff7a3bb2b3f927aa3dcc54a8ac17c1266baccdae89d5fd29e2adc9adcde11f58b9543c8a7cb7f70a2d72548bfa51ddc537a26
7
- data.tar.gz: 8c122474d7dc0e302ce4a2190496eabdaf55dbd54bf10e4aba79cfc9c4f579050bccfc5076030cfb88af081e52618490907d5a4895f26beafb11ea0f804656c6
6
+ metadata.gz: 6a2980445c68c60aa352db4ffd3f64eaf953c82f271a2adc429fc85aa9e570dfc9e2ff710c053909f59f8799bf6459f248872780c8bb572f476fc6dfa1af8fa1
7
+ data.tar.gz: 46d0e3c9d27ee12ebded243fee5ddc0da0567a2cb109b02c56d947aed20304760b4f218f2368de83ec0190117e9033cd8bd3ee424eebcdb7609c5513e2595317
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- ## 0.1.0 11/07/2019
4
+ ## 0.1.0 11/08/2019
5
5
  * Instrumention for OpenTracing using the rack middleware
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-instrumentation (0.1.0.pre)
4
+ rack-instrumentation (0.1.0.pre2)
5
5
  opentracing (~> 0.5.0)
6
6
 
7
7
  GEM
@@ -18,29 +18,33 @@ module Rack
18
18
 
19
19
  def call(env)
20
20
  tracer.start_active_span(*span_args(env)) do |scope|
21
- span = scope.span
22
- env['rack.span'] = span
23
-
24
- app.call(env).tap do |status_code, _headers, _body|
25
- span.set_tag('http.status_code', status_code)
26
-
27
- route = route_from_env(env)
28
- span.operation_name = route if route
29
- end
30
- rescue StandardError => e
31
- span.set_tag('error', true)
32
- span.log_kv(
33
- event: 'error',
34
- :'error.kind' => e.class.to_s,
35
- :'error.object' => e,
36
- message: e.message,
37
- stack: e.backtrace.join("\n")
38
- )
39
- raise
21
+ trace_request(env, scope)
40
22
  end
41
23
  end
42
24
 
43
25
  private
26
+
27
+ def trace_request(env, scope)
28
+ span = scope.span
29
+ env['rack.span'] = span
30
+
31
+ app.call(env).tap do |status_code, _headers, _body|
32
+ span.set_tag('http.status_code', status_code)
33
+
34
+ route = route_from_env(env)
35
+ span.operation_name = route if route
36
+ end
37
+ rescue StandardError => e
38
+ span.set_tag('error', true)
39
+ span.log_kv(
40
+ event: 'error',
41
+ :'error.kind' => e.class.to_s,
42
+ :'error.object' => e,
43
+ message: e.message,
44
+ stack: e.backtrace.join("\n")
45
+ )
46
+ raise
47
+ end
44
48
 
45
49
  def span_args(env)
46
50
  method = env["REQUEST_METHOD"]
@@ -50,7 +54,7 @@ module Rack
50
54
  method,
51
55
  child_of: context,
52
56
  tags: {
53
- 'component' => 'rack',
57
+ 'component' => 'ruby-rack',
54
58
  'span.kind' => 'server',
55
59
  'http.method' => method,
56
60
  'http.url' => env["REQUEST_URI"]
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Instrumentation
3
- VERSION = "0.1.0.pre"
3
+ VERSION = "0.1.0.pre2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.1.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lauer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2019-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentracing