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
-
#sampling_rate ⇒ Float
Default is 0.1%.
- #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 |
# 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'] || 0.001) @solr_hook_name = 'solr' end |
Instance Attribute Details
#client_options ⇒ Hash
54 55 56 |
# File 'lib/aws/xray/configuration.rb', line 54 def @client_options end |
#default_annotation ⇒ Hash
69 70 71 |
# File 'lib/aws/xray/configuration.rb', line 69 def default_annotation @default_annotation end |
#default_metadata ⇒ Hash
78 79 80 |
# File 'lib/aws/xray/configuration.rb', line 78 def @default_metadata end |
#excluded_paths ⇒ Array<String>
58 59 60 |
# File 'lib/aws/xray/configuration.rb', line 58 def excluded_paths @excluded_paths end |
#logger ⇒ Logger
101 102 103 |
# File 'lib/aws/xray/configuration.rb', line 101 def logger @logger end |
#name ⇒ String
48 49 50 |
# File 'lib/aws/xray/configuration.rb', line 48 def name @name end |
#sampling_rate ⇒ Float
Default is 0.1%.
97 98 99 |
# File 'lib/aws/xray/configuration.rb', line 97 def sampling_rate @sampling_rate end |
#segment_sending_error_handler ⇒ Object
81 82 83 |
# File 'lib/aws/xray/configuration.rb', line 81 def segment_sending_error_handler @segment_sending_error_handler end |
#solr_hook_name ⇒ String
105 106 107 |
# File 'lib/aws/xray/configuration.rb', line 105 def solr_hook_name @solr_hook_name end |
#version ⇒ String
61 62 63 |
# File 'lib/aws/xray/configuration.rb', line 61 def version @version end |
#worker ⇒ Aws::Xray::Worker::Configuration
84 85 86 |
# File 'lib/aws/xray/configuration.rb', line 84 def worker @worker end |