Class: Atatus::Span::Context::Destination Private

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/span/context/destination.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, resource: nil, type: nil, address: nil, port: nil) ⇒ Destination

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Destination.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/atatus/span/context/destination.rb', line 25

def initialize(
  name: nil,
  resource: nil,
  type: nil,
  address: nil,
  port: nil
)
  @name = name
  @resource = resource
  @type = type
  @address = address
  @port = port
end

Instance Attribute Details

#addressObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/atatus/span/context/destination.rb', line 39

def address
  @address
end

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/atatus/span/context/destination.rb', line 39

def name
  @name
end

#portObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/atatus/span/context/destination.rb', line 39

def port
  @port
end

#resourceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/atatus/span/context/destination.rb', line 39

def resource
  @resource
end

#typeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/atatus/span/context/destination.rb', line 39

def type
  @type
end

Class Method Details

.from_uri(uri_or_str, type: 'external', port: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/atatus/span/context/destination.rb', line 47

def self.from_uri(uri_or_str, type: 'external', port: nil)
  uri = normalize(uri_or_str)

  new(
    name: only_scheme_and_host(uri),
    resource: "#{uri.host}:#{uri.port}",
    type: type,
    address: uri.hostname,
    port: port || uri.port
  )
end

.only_scheme_and_host(uri_or_str) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



59
60
61
62
63
64
# File 'lib/atatus/span/context/destination.rb', line 59

def self.only_scheme_and_host(uri_or_str)
  uri = normalize(uri_or_str)
  uri.path = ''
  uri.password = uri.query = uri.fragment = nil
  uri.to_s
end