the_garage 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/garage/tracer.rb +2 -33
- data/lib/garage/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8bcdbb3fc2ac73accc53baf8d79885ac8cf7b87
|
4
|
+
data.tar.gz: a51a1b809c89f4aeecb8af09d1586407bdbe546e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c2f76b2c2f65b0dd09219a2853ca31723259a3a9f863f11f787741b2a6b9d352db80ef46008ad2142ec8466763c57628ec60fa0e7109c7c3c25eecda0f728a
|
7
|
+
data.tar.gz: c1ee5249a83694c6ee4b569b957142e8bd7c1bb82b07fba73007fc1b04011bf3e834344fdedd76e79150ea782286f1d77b16fb700404ca70942c6815b15adfe0
|
data/README.md
CHANGED
@@ -197,7 +197,7 @@ Currently, we support following tracers:
|
|
197
197
|
|
198
198
|
```ruby
|
199
199
|
# e.g. aws-xray tracer
|
200
|
-
require 'aws/xray'
|
200
|
+
require 'aws/xray/hooks/net_http'
|
201
201
|
Garage::Tracer::AwsXrayTracer.service = 'your-auth-server-name'
|
202
202
|
Garage.configuration.tracer = Garage::Tracer::AwsXrayTracer
|
203
203
|
```
|
data/lib/garage/tracer.rb
CHANGED
@@ -45,48 +45,17 @@ module Garage
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.start(&block)
|
48
|
-
|
49
|
-
Aws::Xray::Context.current.child_trace(remote: true, name: service) do |sub|
|
50
|
-
if Aws::Xray::Context.current.respond_to?(:disable_trace)
|
51
|
-
Aws::Xray::Context.current.disable_trace(:net_http) { yield new(sub) }
|
52
|
-
else
|
53
|
-
yield new(sub)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
else
|
57
|
-
yield NullTracer.new
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def initialize(sub_segment)
|
62
|
-
@sub = sub_segment
|
48
|
+
yield new
|
63
49
|
end
|
64
50
|
|
65
51
|
def inject_trace_context(header)
|
66
|
-
header.merge('X-
|
52
|
+
header.merge('X-Aws-Xray-Name' => self.class.service)
|
67
53
|
end
|
68
54
|
|
69
55
|
def record_http_request(method, url, user_agent)
|
70
|
-
request = Aws::Xray::Request.build(method: method.to_s.upcase, url: url, user_agent: user_agent)
|
71
|
-
@sub.set_http_request(request)
|
72
56
|
end
|
73
57
|
|
74
58
|
def record_http_response(status, content_length)
|
75
|
-
@sub.set_http_response(status, content_length || 0)
|
76
|
-
|
77
|
-
case status
|
78
|
-
when 499
|
79
|
-
cause = Aws::Xray::Cause.new(stack: caller, message: 'Got 499', type: 'http_request_error')
|
80
|
-
@sub.set_error(error: true, throttle: true, cause: cause)
|
81
|
-
when 400..498
|
82
|
-
cause = Aws::Xray::Cause.new(stack: caller, message: 'Got 4xx', type: 'http_request_error')
|
83
|
-
@sub.set_error(error: true, cause: cause)
|
84
|
-
when 500..599
|
85
|
-
cause = Aws::Xray::Cause.new(stack: caller, message: 'Got 5xx', type: 'http_request_error')
|
86
|
-
@sub.set_error(fault: true, remote: true, cause: cause)
|
87
|
-
else
|
88
|
-
# pass
|
89
|
-
end
|
90
59
|
end
|
91
60
|
end
|
92
61
|
end
|
data/lib/garage/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_garage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuhiko Miyagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
version: '0'
|
272
272
|
requirements: []
|
273
273
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.
|
274
|
+
rubygems_version: 2.5.2
|
275
275
|
signing_key:
|
276
276
|
specification_version: 4
|
277
277
|
summary: Garage Platform Engine
|