aws-xray 0.37.2 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +3 -0
- data/README.md +0 -8
- data/aws-xray.gemspec +1 -1
- data/lib/aws/xray/hooks/all.rb +0 -1
- data/lib/aws/xray/sockets.rb +2 -0
- data/lib/aws/xray/version.rb +1 -1
- metadata +10 -11
- data/lib/aws/xray/hooks/active_record.rb +0 -86
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ebaad8e050c5b8f917c956164dd5a7769c1c4dee5dd5ddb0d771899f4f2d451
|
4
|
+
data.tar.gz: 3574a9341bae80e8efef838287e6d0e42e8567c794ff5ffbbf45e4a5edbf29dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00fe3dd905a62456ebf301d7954650a9b53a4a8aff850372c2e278431ba6cca0de1ee9f7c822e8626d9da1ab6c8223356c8409ff9c180928893457b2594fcbd7
|
7
|
+
data.tar.gz: 634b7769eaca9aab5f17a0784d2da4e1144f93a88afdea3dd40344ea42cbe17a72c08fa82cc0209ddb67688a54e9667984376e3f46a6b8edf3d9a2b92fd7d89c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
Only breaking or notable changes.
|
3
3
|
|
4
|
+
## v0.38.0
|
5
|
+
- aws/xray/hooks/active_record was removed because it's not usable due to too many traces
|
6
|
+
|
4
7
|
## v0.34.0
|
5
8
|
- Change default sampling rate from 0.1% to undefined. Please set proper sampling rate in your production system.
|
6
9
|
|
data/README.md
CHANGED
@@ -23,7 +23,6 @@ aws-xray has full feautres to build and send tracing data to AWS X-Ray.
|
|
23
23
|
- net/http
|
24
24
|
- rack
|
25
25
|
- faraday
|
26
|
-
- activerecord
|
27
26
|
- rsolr
|
28
27
|
|
29
28
|
## Getting started
|
@@ -196,8 +195,6 @@ You can enable all the hooks with:
|
|
196
195
|
gem 'aws-xray', require: 'aws/xray/hooks/all'
|
197
196
|
```
|
198
197
|
|
199
|
-
NOTE: activerecord hook won't be enabled by this because the hook may produce lots of trace records.
|
200
|
-
|
201
198
|
#### net/http hook
|
202
199
|
To monkey patch net/http and records out-going http requests automatically, just require `aws/xray/hooks/net_http`:
|
203
200
|
|
@@ -219,11 +216,6 @@ response = Aws::Xray.overwrite(name: 'sns') do
|
|
219
216
|
end
|
220
217
|
```
|
221
218
|
|
222
|
-
#### activerecord hook
|
223
|
-
`require 'aws/xray/hooks/active_record'`.
|
224
|
-
|
225
|
-
Note this hook can record large amount of data.
|
226
|
-
|
227
219
|
#### rsolr hook
|
228
220
|
When you want to name solr requests, use this hook by require `aws/xray/hooks/rsolr`. The typical usecase is you use local haproxy to proxy to solr instances and you want to distinguish these requests from other reqeusts using local haproxy.
|
229
221
|
|
data/aws-xray.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_dependency 'rack'
|
25
|
-
spec.add_development_dependency 'activerecord'
|
26
25
|
spec.add_development_dependency 'bundler'
|
27
26
|
spec.add_development_dependency 'coveralls'
|
28
27
|
spec.add_development_dependency 'faraday'
|
28
|
+
spec.add_development_dependency 'irb'
|
29
29
|
spec.add_development_dependency 'json-schema'
|
30
30
|
spec.add_development_dependency 'pry-byebug'
|
31
31
|
spec.add_development_dependency 'rack-test'
|
data/lib/aws/xray/hooks/all.rb
CHANGED
data/lib/aws/xray/sockets.rb
CHANGED
data/lib/aws/xray/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-xray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taiki Ono
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: irb
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -276,7 +276,6 @@ files:
|
|
276
276
|
- lib/aws/xray/errors.rb
|
277
277
|
- lib/aws/xray/faraday.rb
|
278
278
|
- lib/aws/xray/header_parser.rb
|
279
|
-
- lib/aws/xray/hooks/active_record.rb
|
280
279
|
- lib/aws/xray/hooks/all.rb
|
281
280
|
- lib/aws/xray/hooks/net_http.rb
|
282
281
|
- lib/aws/xray/hooks/rsolr.rb
|
@@ -296,7 +295,7 @@ homepage: https://github.com/taiki45/aws-xray
|
|
296
295
|
licenses:
|
297
296
|
- MIT
|
298
297
|
metadata: {}
|
299
|
-
post_install_message:
|
298
|
+
post_install_message:
|
300
299
|
rdoc_options: []
|
301
300
|
require_paths:
|
302
301
|
- lib
|
@@ -311,8 +310,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
311
310
|
- !ruby/object:Gem::Version
|
312
311
|
version: '0'
|
313
312
|
requirements: []
|
314
|
-
rubygems_version: 3.
|
315
|
-
signing_key:
|
313
|
+
rubygems_version: 3.2.13
|
314
|
+
signing_key:
|
316
315
|
specification_version: 4
|
317
316
|
summary: The unofficial X-Ray Tracing SDK for Ruby.
|
318
317
|
test_files: []
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'aws/xray'
|
2
|
-
require 'active_record'
|
3
|
-
|
4
|
-
module Aws
|
5
|
-
module Xray
|
6
|
-
module Hooks
|
7
|
-
module ActiveRecord
|
8
|
-
extend self
|
9
|
-
|
10
|
-
IGNORE_NAMES = ['SCHEMA', 'ActiveRecord::SchemaMigration Load']
|
11
|
-
|
12
|
-
# event has #name, #time, #end, #duration, #payload
|
13
|
-
# payload has #sql, #name, #connection_id, #binds, #cached
|
14
|
-
#
|
15
|
-
# @param [ActiveSupport::Notifications::Event] e
|
16
|
-
def record(e)
|
17
|
-
return if IGNORE_NAMES.include?(e.payload[:name])
|
18
|
-
|
19
|
-
if !e.payload[:cached] && Aws::Xray::Context.started?
|
20
|
-
pool, con = fetch_connection_and_pool(e.payload[:connection_id])
|
21
|
-
return if pool.nil? || con.nil?
|
22
|
-
name = build_name(pool.spec)
|
23
|
-
return unless name # skip when connected to default host (typycally localhost)
|
24
|
-
|
25
|
-
Aws::Xray::Context.current.start_subsegment(name: name, remote: true) do |sub|
|
26
|
-
sub.start(e.time)
|
27
|
-
sub.finish(e.end)
|
28
|
-
sub.set_sql(Aws::Xray::Sql.build(
|
29
|
-
url: build_url(pool.spec),
|
30
|
-
database_version: build_version(con),
|
31
|
-
))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def fetch_connection_and_pool(id)
|
39
|
-
pool, con = nil, nil
|
40
|
-
::ActiveRecord::Base.connection_handler.connection_pool_list.each do |p|
|
41
|
-
p.connections.each do |c|
|
42
|
-
if c.object_id == id
|
43
|
-
pool, con = p, c
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
return pool, con
|
48
|
-
end
|
49
|
-
|
50
|
-
def build_name(spec)
|
51
|
-
spec.config.with_indifferent_access[:host]
|
52
|
-
end
|
53
|
-
|
54
|
-
def build_url(spec)
|
55
|
-
config = spec.config.with_indifferent_access
|
56
|
-
adapter = config.delete(:adapter) || 'unknown'
|
57
|
-
host = config.delete(:host) || 'localhost'
|
58
|
-
port = config.delete(:port) || ''
|
59
|
-
username = config.delete(:username) || ''
|
60
|
-
database = config.delete(:database) || ''
|
61
|
-
config.delete(:password)
|
62
|
-
query = config.map {|k, v| "#{k}=#{v}" }.join('&')
|
63
|
-
query_str = query.empty? ? '' : "?#{query}"
|
64
|
-
"#{adapter}://#{username}@#{host}:#{port}/#{database}#{query_str}"
|
65
|
-
end
|
66
|
-
|
67
|
-
def build_version(con)
|
68
|
-
if con.respond_to?(:version)
|
69
|
-
if (v = con.version.instance_variable_get('@version'))
|
70
|
-
v.join('.')
|
71
|
-
else
|
72
|
-
nil
|
73
|
-
end
|
74
|
-
else
|
75
|
-
nil
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# maybe old version?
|
84
|
-
ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
85
|
-
Aws::Xray::Hooks::ActiveRecord.record(ActiveSupport::Notifications::Event.new(*args))
|
86
|
-
end
|