Class: Zipkin::Endpoint
- Inherits:
-
Object
- Object
- Zipkin::Endpoint
- Defined in:
- lib/zipkin/endpoint.rb
Defined Under Namespace
Constant Summary collapse
- LOCAL_IP =
( Socket.ip_address_list.detect(&:ipv4_private?) || Socket.ip_address_list.reverse.detect(&:ipv4?) ).ip_address
Class Method Summary collapse
Class Method Details
.local_endpoint(service_name) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/zipkin/endpoint.rb', line 30 def self.local_endpoint(service_name) { serviceName: service_name, ipv4: LOCAL_IP } end |
.remote_endpoint(span) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zipkin/endpoint.rb', line 37 def self.remote_endpoint(span) = span. kind = [:'span.kind'] || SpanKind::SERVER case kind when SpanKind::SERVER, SpanKind::CLIENT return nil if (.keys & PeerInfo.keys).empty? { serviceName: [PeerInfo::SERVICE], ipv4: [PeerInfo::IPV4], ipv6: [PeerInfo::IPV6], port: [PeerInfo::PORT] } when SpanKind::PRODUCER, SpanKind::CONSUMER { serviceName: 'broker' } else warn "Unkown span kind: #{kind}" nil end end |