-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from haotianw465/master
Service sampling rules support
- Loading branch information
Showing
37 changed files
with
1,143 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--title 'AWS X-Ray SDK for Ruby' | ||
--markup markdown | ||
--template-path doc-src/templates | ||
--no-progress | ||
- LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div id="footer"> | ||
Generated on <%= Time.now.strftime("%c") %> by | ||
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> | ||
<%= YARD::VERSION %> (ruby-<%= RUBY_VERSION %>). | ||
<script src="/SdkStatic/sdk-priv.js" async="true"></script> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def javascripts | ||
(super + %w(js/tabs.js)).uniq | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'aws-xray-sdk/exceptions' | ||
|
||
module XRay | ||
# The class that stores X-Ray daemon configuration about | ||
# the ip address and port for UDP and TCP port. It gets the address | ||
# string from `AWS_XRAY_DAEMON_ADDRESS` and then from recorder's | ||
# configuration for `daemon_address`. | ||
# A notation of `127.0.0.1:2000` or `tcp:127.0.0.1:2000 udp:127.0.0.2:2001` | ||
# are both acceptable. The former one means UDP and TCP are running at | ||
# the same address. By default it assumes a X-Ray daemon | ||
# running at `127.0.0.1:2000` listening to both UDP and TCP traffic. | ||
class DaemonConfig | ||
DAEMON_ADDRESS_KEY = 'AWS_XRAY_DAEMON_ADDRESS'.freeze | ||
attr_reader :tcp_ip, :tcp_port, :udp_ip, :udp_port | ||
@@dafault_addr = '127.0.0.1:2000' | ||
|
||
def initialize(addr: @@dafault_addr) | ||
update_address(addr) | ||
end | ||
|
||
def update_address(v) | ||
v = ENV[DAEMON_ADDRESS_KEY] || v | ||
update_addr(v) | ||
rescue StandardError | ||
raise InvalidDaemonAddressError, %(Invalid X-Ray daemon address specified: #{v}.) | ||
end | ||
|
||
private | ||
|
||
def update_addr(v) | ||
parts = v.split(' ') | ||
if parts.length == 1 # format of '127.0.0.1:2000' | ||
addr = parts[0].split(':') | ||
raise InvalidDaemonAddressError unless addr.length == 2 | ||
@tcp_ip = addr[0] | ||
@tcp_port = addr[1].to_i | ||
@udp_ip = addr[0] | ||
@udp_port = addr[1].to_i | ||
else | ||
set_tcp_udp(parts) # format of 'tcp:127.0.0.1:2000 udp:127.0.0.2:2001' | ||
end | ||
end | ||
|
||
def set_tcp_udp(parts) | ||
part1 = parts[0] | ||
part2 = parts[1] | ||
key1 = part1.split(':')[0] | ||
key2 = part2.split(':')[0] | ||
addr_h = {} | ||
addr_h[key1] = part1.split(':') | ||
addr_h[key2] = part2.split(':') | ||
|
||
@tcp_ip = addr_h['tcp'][1] | ||
@tcp_port = addr_h['tcp'][2].to_i | ||
@udp_ip = addr_h['udp'][1] | ||
@udp_port = addr_h['udp'][2].to_i | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,10 @@ def aws=(v) | |
# no-op | ||
end | ||
|
||
def sampling_rule_name=(v) | ||
# no-op | ||
end | ||
|
||
def to_h | ||
# no-op | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.