public final class Endpoint extends Object
When a BinaryAnnotation, and key is Constants.CLIENT_ADDR
or Constants.SERVER_ADDR
, the endpoint indicates the source or destination of an RPC. This
exception allows zipkin to display network context of uninstrumented services, or clients such as
web browsers.
Modifier and Type | Class and Description |
---|---|
static class |
Endpoint.Builder |
Modifier and Type | Field and Description |
---|---|
int |
ipv4
IPv4 endpoint address packed into 4 bytes or zero if unknown.
|
byte[] |
ipv6
IPv6 endpoint address packed into 16 bytes or null if unknown.
|
Short |
port
Port of the IP's socket or null, if not known.
|
String |
serviceName
Classifier of a source or destination in lowercase, such as "zipkin-server".
|
Modifier and Type | Method and Description |
---|---|
static Endpoint.Builder |
builder() |
static Endpoint |
create(String serviceName,
int ipv4) |
static Endpoint |
create(String serviceName,
int ipv4,
int port) |
boolean |
equals(Object o) |
int |
hashCode() |
Endpoint.Builder |
toBuilder() |
public final String serviceName
This is the primary parameter for trace lookup, so should be intuitive as possible, for example, matching names in service discovery.
Conventionally, when the service name isn't known, service_name = "unknown". However, it is also permissible to set service_name = "" (empty string). The difference in the latter usage is that the span will not be queryable by service name unless more information is added to the span with non-empty service name, e.g. an additional annotation from the server.
Particularly clients may not have a reliable service name at ingest. One approach is to set service_name to "" at ingest, and later assign a better label based on binary annotations, such as user agent.
public final int ipv4
Ex for the IP 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4
Inet4Address.getAddress()
@Nullable public final byte[] ipv6
Inet6Address.getAddress()
@Nullable public final Short port
Note: this is to be treated as an unsigned integer, so watch for negatives.
InetSocketAddress.getPort()
public Endpoint.Builder toBuilder()
public static Endpoint.Builder builder()
Copyright © 2015–2016 OpenZipkin. All rights reserved.