Class: ZipkinTracer::HostnameResolver
- Inherits:
-
Object
- Object
- ZipkinTracer::HostnameResolver
- Defined in:
- lib/zipkin-tracer/hostname_resolver.rb
Overview
Resolves hostnames in the endpoints of the annotations. Resolving hostnames is a very expensive operation. We want to store them raw in the main thread and resolve them in a different thread where we do not affect execution times.
Instance Method Summary collapse
Instance Method Details
#spans_with_ips(spans) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/zipkin-tracer/hostname_resolver.rb', line 6 def spans_with_ips(spans) host_to_ip = hosts_to_ipv4(spans) each_annotation(spans) do |annotation| hostname = annotation.host.ipv4 if hostname.to_s =~ /\A[a-zA-Z]/ # hostnames start with letters, else we already have an IP annotation.host.ipv4 = host_to_ip[hostname] end end end |