Class: Aws::Xray::Configuration
- Inherits:
-
Object
- Object
- Aws::Xray::Configuration
- Defined in:
- lib/aws/xray/configuration.rb
Overview
thread-unsafe, suppose to be used only in initialization phase.
Constant Summary collapse
- DEFAULT_ANNOTATION =
Freeze to force users to set default annotation with writer method.
{ hostname: Socket.gethostname, }.freeze
- DEFAULT_METADATA =
{ tracing_sdk: { name: 'aws-xray', version: Aws::Xray::VERSION, } }.freeze
Instance Attribute Summary collapse
- #client_options ⇒ Hash
- #default_annotation ⇒ Hash
- #default_metadata ⇒ Hash
- #excluded_paths ⇒ Array<String>
- #logger ⇒ Logger
- #name ⇒ String
- #record_caller_of_http_requests ⇒ Boolean
-
#sampling_rate ⇒ Float
Default is undefined.
- #segment_sending_error_handler ⇒ Object
- #solr_hook_name ⇒ String
- #version ⇒ String
- #worker ⇒ Aws::Xray::Worker::Configuration
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/aws/xray/configuration.rb', line 22 def initialize @logger = ::Logger.new($stdout).tap {|l| l.level = Logger::INFO } @name = ENV['AWS_XRAY_NAME'] @client_options = begin option = (ENV['AWS_XRAY_LOCATION'] || '').split(':') host = option[0] port = option[1] if (host && !host.empty?) && (port && !port.empty?) { host: host, port: Integer(port) } else { sock: NullSocket.new } end end @excluded_paths = (ENV['AWS_XRAY_EXCLUDED_PATHS'] || '').split(',') @version = VersionDetector.new.call @default_annotation = DEFAULT_ANNOTATION @default_metadata = DEFAULT_METADATA @segment_sending_error_handler = DefaultErrorHandler.new($stderr) @worker = Aws::Xray::Worker::Configuration.new @sampling_rate = Float(ENV['AWS_XRAY_SAMPLING_RATE'] || 1.0) @solr_hook_name = 'solr' @record_caller_of_http_requests = false end |
Instance Attribute Details
#client_options ⇒ Hash
55 56 57 |
# File 'lib/aws/xray/configuration.rb', line 55 def @client_options end |
#default_annotation ⇒ Hash
70 71 72 |
# File 'lib/aws/xray/configuration.rb', line 70 def default_annotation @default_annotation end |
#default_metadata ⇒ Hash
79 80 81 |
# File 'lib/aws/xray/configuration.rb', line 79 def @default_metadata end |
#excluded_paths ⇒ Array<String>
59 60 61 |
# File 'lib/aws/xray/configuration.rb', line 59 def excluded_paths @excluded_paths end |
#logger ⇒ Logger
102 103 104 |
# File 'lib/aws/xray/configuration.rb', line 102 def logger @logger end |
#name ⇒ String
49 50 51 |
# File 'lib/aws/xray/configuration.rb', line 49 def name @name end |
#record_caller_of_http_requests ⇒ Boolean
110 111 112 |
# File 'lib/aws/xray/configuration.rb', line 110 def record_caller_of_http_requests @record_caller_of_http_requests end |
#sampling_rate ⇒ Float
Default is undefined.
98 99 100 |
# File 'lib/aws/xray/configuration.rb', line 98 def sampling_rate @sampling_rate end |
#segment_sending_error_handler ⇒ Object
82 83 84 |
# File 'lib/aws/xray/configuration.rb', line 82 def segment_sending_error_handler @segment_sending_error_handler end |
#solr_hook_name ⇒ String
106 107 108 |
# File 'lib/aws/xray/configuration.rb', line 106 def solr_hook_name @solr_hook_name end |
#version ⇒ String
62 63 64 |
# File 'lib/aws/xray/configuration.rb', line 62 def version @version end |
#worker ⇒ Aws::Xray::Worker::Configuration
85 86 87 |
# File 'lib/aws/xray/configuration.rb', line 85 def worker @worker end |