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 +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/lib/rack/instrumentation/tracer.rb +24 -20
- data/lib/rack/instrumentation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43576358d3b5c78c10dc0bc3143897a0f4fdc3020e94585e5200cd9601616e22
|
4
|
+
data.tar.gz: 0ae639fbc6acce667e4e80122fda384b19a87bd19532badfb397cc2bda57c901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a2980445c68c60aa352db4ffd3f64eaf953c82f271a2adc429fc85aa9e570dfc9e2ff710c053909f59f8799bf6459f248872780c8bb572f476fc6dfa1af8fa1
|
7
|
+
data.tar.gz: 46d0e3c9d27ee12ebded243fee5ddc0da0567a2cb109b02c56d947aed20304760b4f218f2368de83ec0190117e9033cd8bd3ee424eebcdb7609c5513e2595317
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
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"]
|
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.
|
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-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentracing
|