Class: Aws::Xray::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/xray/configuration.rb

Overview

thread-unsafe, suppose to be used only in initialization phase.

Constant Summary collapse

DEFAULT_ANNOTATION =
{
  hostname: Socket.gethostname,
}.freeze
DEFAULT_METADATA =
{
  tracing_sdk: {
    name: 'aws-xray',
    version: Aws::Xray::VERSION,
  }
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#client_optionsHash

Returns client_options For xray-agent client.

  • host: e.g. ‘127.0.0.1’

  • port: e.g. 2000

  • sock: test purpose.

Returns:

  • (Hash)

    client_options For xray-agent client.

    • host: e.g. ‘127.0.0.1’

    • port: e.g. 2000

    • sock: test purpose.



15
16
17
# File 'lib/aws/xray/configuration.rb', line 15

def client_options
  @client_options ||= { host: '127.0.0.1', port: 2000 }
end

#default_metadataHash

Returns Default metadata.

Returns:

  • (Hash)

    Default metadata.



50
51
52
# File 'lib/aws/xray/configuration.rb', line 50

def 
  @default_metadata ||= DEFAULT_METADATA
end

#nameString

Returns name Logical service name for this application.

Returns:

  • (String)

    name Logical service name for this application.



9
10
11
# File 'lib/aws/xray/configuration.rb', line 9

def name
  @name
end

Instance Method Details

#default_annotationHash

Returns default annotation with key-value format.

Returns:

  • (Hash)

    default annotation with key-value format.



34
35
36
# File 'lib/aws/xray/configuration.rb', line 34

def default_annotation
  @default_annotation ||= DEFAULT_ANNOTATION
end

#default_annotation=(annotation) ⇒ Object

Parameters:

  • h (Hash)

    default annotation Hash.



38
39
40
41
# File 'lib/aws/xray/configuration.rb', line 38

def default_annotation=(annotation)
  AnnotationValidator.call(annotation)
  @default_annotation = annotation
end

#versionString

Returns:

  • (String)


21
22
23
# File 'lib/aws/xray/configuration.rb', line 21

def version
  @version ||= VersionDetector.new.call
end

#version=(v) ⇒ Object

Parameters:

  • version (String, Proc)

    A String or callable object which returns application version. Default version detection tries to solve with ‘app_root/REVISION` file.



26
27
28
# File 'lib/aws/xray/configuration.rb', line 26

def version=(v)
  @version = v.respond_to?(:call) ? v.call : v
end