class Aws::Xray::Configuration
thread-unsafe, suppose to be used only in initialization phase.
Constants
- DEFAULT_ANNOTATION
Freeze to force users to set default annotation with writer method.
- DEFAULT_METADATA
Attributes
@param [Hash] client_options
For xray-agent client.
- host: e.g. '127.0.0.1' - port: e.g. 2000
@return [Hash]
@return [Hash]
@param [Hash] default_metadatametadata Default metadata. @return [Hash]
@param [Array<String>] excluded_paths
@return [Array<String>]
@param [Logger] logger @return [Logger]
@param [String] name Logical service name for this application. @return [String]
@param [Boolean] record_caller_of_http_requests
@return [Boolean]
Default is undefined. @param [Float] sampling_rate
@return [Float]
@param [Proc] segment_sending_error_handler
Callable object
@param [String] solr_hook_name
@return [String]
@return [String]
@return [Aws::Xray::Worker::Configuration]
Public Class Methods
# 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
Public Instance Methods
@param [Hash] annotation annotation with key-value format. keys and
values are automatically normalized according to X-Ray's format spec.
# File lib/aws/xray/configuration.rb, line 73 def default_annotation=(annotation) @default_annotation = AnnotationNormalizer.call(annotation) end
@param [String,Proc] version A String or callable object which returns application version.
Default version detection tries to solve with `app_root/REVISION` file.
# File lib/aws/xray/configuration.rb, line 65 def version=(v) @version = v.respond_to?(:call) ? v.call : v end
Set given configuration and reset workers according to the given configuration. @param [Aws::Xray::Worker::Configuration] conf
# File lib/aws/xray/configuration.rb, line 89 def worker=(conf) @worker = conf Aws::Xray::Worker.reset(conf) conf end