Class: ElasticAPM::Span::Context::Destination Private

Inherits:
Object
  • Object
show all
Includes:
Fields
Defined in:
lib/elastic_apm/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.

Defined Under Namespace

Classes: Cloud, Service

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Fields

included

Constructor Details

#initialize(service: nil, cloud: nil, **attrs) ⇒ 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.



48
49
50
51
52
53
# File 'lib/elastic_apm/span/context/destination.rb', line 48

def initialize(service: nil, cloud: nil, **attrs)
  super(**attrs)

  self.service = build_service(service)
  self.cloud = build_cloud(cloud)
end

Class Method Details

.from_uri(uri_or_str, type: nil, **attrs) ⇒ 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.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/elastic_apm/span/context/destination.rb', line 55

def self.from_uri(uri_or_str, type: nil, **attrs)
  uri = normalize(uri_or_str)

  service =
    case type
    when 'http' then http_service(uri)
    else nil
    end

  new(
    address: uri.hostname,
    port: uri.port,
    service: service,
    **attrs
  )
end