Tapper v0.2.0 Tapper.Endpoint

Endpoint description struct; used in the API where a host endpoint is required.

Example

endpoint = %Endpoint{
  ip: {192, 168, 10, 100},
  service_name: "my-service",
  port: 80
}

Tapper.update_span(id, Tapper.server_address(endpoint))

The ip field is either an IPV4 or an IPV6 address, as a 4- or 8-tuple; the port will default to 0.

The Default Endpoint

Most APIs support passing an Endpoint, but do not require it. This is because in most circumstances, the endpoint is that belonging to the caller, i.e. the server or clients host; Tapper provides a default Endpoint in this case, set by the application from configuration, on start-up. See Tapper.Application for details.

DNS lookup

Instead of an ip address, the hostname field can provide a DNS name (as a String.t or atom) which will be resolved to an IP address (see Tapper.Tracer.Trace.Convert) when the span is reported:

endpoint = %Endpoint{
  hostname: "my-service.ft.com",
  service_name: "my-service",
  port: 80
}

NB because DNS resolution happens asynchronously, the resulting IP address may not correspond the actual IP address connected to, e.g. if the service is being IP load-balanced by an AWS ALB. You can use the resolve/1 function before adding an annotation to make it slightly more likely to be the same IP address, at the expense of doing this in the client process, rather than in Tapper’s server.

Summary

Functions

get the first non-loopback IP interface address tuple, preferring ipv4 over ip6

Resolve the DNS hostname field in an Endpoint, setting the ip address field

Types

ip_address()
ip_address() :: :inet.ip_address
t()
t() :: %Tapper.Endpoint{hostname: String.t | atom | nil, ip: ip_address | nil, port: integer | nil, service_name: String.t | nil}

Functions

host_ip()
host_ip() :: Tapper.ip_address

get the first non-loopback IP interface address tuple, preferring ipv4 over ip6

resolve(endpoint)
resolve(endpoint :: Tapper.Endpoint.t) :: Tapper.Endpoint.t

Resolve the DNS hostname field in an Endpoint, setting the ip address field.