class Zipkin::Endpoint

Constants

LOCAL_IP

Attributes

ipv4[R]
ipv6[R]
port[R]
service_name[R]

Public Class Methods

local_endpoint(service_name) click to toggle source
# File lib/zipkin/endpoint.rb, line 30
def self.local_endpoint(service_name)
  new(service_name: service_name, ipv4: LOCAL_IP)
end
new(service_name: nil, ipv4: nil, ipv6: nil, port: nil) click to toggle source
# File lib/zipkin/endpoint.rb, line 56
def initialize(service_name: nil, ipv4: nil, ipv6: nil, port: nil)
  @service_name = service_name
  @ipv4 = ipv4
  @ipv6 = ipv6
  @port = port
end
remote_endpoint(span) click to toggle source
# File lib/zipkin/endpoint.rb, line 34
def self.remote_endpoint(span)
  tags = span.tags
  kind = tags['span.kind'] || SpanKind::SERVER

  case kind
  when SpanKind::SERVER, SpanKind::CLIENT
    return nil if (tags.keys & PeerInfo.keys).empty?

    new(
      service_name: tags[PeerInfo::SERVICE],
      ipv4: tags[PeerInfo::IPV4],
      ipv6: tags[PeerInfo::IPV6],
      port: tags[PeerInfo::PORT]
    )
  when SpanKind::PRODUCER, SpanKind::CONSUMER
    new(service_name: 'broker')
  else
    warn "Unkown span kind: #{kind}"
    nil
  end
end