public final class BinaryAnnotation extends Object implements Comparable<BinaryAnnotation>
"http.path" could the path to a resource in a RPC call.
Binary annotations of type BinaryAnnotation.Type.STRING are always queryable, though more a historical
implementation detail than a structural concern.
Binary annotations can repeat, and vary on the host. Similar to Annotation, the host indicates who logged the event. This allows you to tell the difference between the client and server side of the same key. For example, the key "http.path" might be different on the client and server side due to rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field, you can see the different points of view, which often help in debugging.
| Modifier and Type | Class and Description |
|---|---|
static class |
BinaryAnnotation.Builder |
static class |
BinaryAnnotation.Type
A subset of thrift base types, except BYTES.
|
| Modifier and Type | Field and Description |
|---|---|
Endpoint |
endpoint
The host that recorded
value, allowing query by service name or address. |
String |
key
Name used to lookup spans, such as
"http.path" or "error" |
BinaryAnnotation.Type |
type
The thrift type of value, most often STRING.
|
byte[] |
value
Serialized thrift bytes, in TBinaryProtocol format.
|
| Modifier and Type | Method and Description |
|---|---|
static BinaryAnnotation |
address(String key,
Endpoint endpoint)
Special-cased form supporting
Constants.CLIENT_ADDR and
Constants.SERVER_ADDR. |
static BinaryAnnotation.Builder |
builder() |
int |
compareTo(BinaryAnnotation that)
Provides consistent iteration by
key |
static BinaryAnnotation |
create(String key,
byte[] value,
BinaryAnnotation.Type type,
Endpoint endpoint) |
static BinaryAnnotation |
create(String key,
String value,
Endpoint endpoint)
String values are the only queryable type of binary annotation.
|
boolean |
equals(Object o) |
int |
hashCode() |
BinaryAnnotation.Builder |
toBuilder() |
String |
toString() |
public final String key
"http.path" or "error"public final byte[] value
For legacy reasons, byte order is big-endian. See THRIFT-3217.
public final BinaryAnnotation.Type type
Note: type shouldn't vary for the same key.
@Nullable public final Endpoint endpoint
value, allowing query by service name or address.
There are two exceptions: when key is Constants.CLIENT_ADDR or Constants.SERVER_ADDR, this is the source or destination of an RPC. This exception allows
zipkin to display network context of uninstrumented services, such as browsers or databases.
public static BinaryAnnotation address(String key, Endpoint endpoint)
Constants.CLIENT_ADDR and
Constants.SERVER_ADDR.key - Constants.CLIENT_ADDR or Constants.SERVER_ADDRendpoint - associated endpoint.public static BinaryAnnotation create(String key, String value, @Nullable Endpoint endpoint)
public static BinaryAnnotation create(String key, byte[] value, BinaryAnnotation.Type type, @Nullable Endpoint endpoint)
public BinaryAnnotation.Builder toBuilder()
public static BinaryAnnotation.Builder builder()
public int compareTo(BinaryAnnotation that)
keycompareTo in interface Comparable<BinaryAnnotation>Copyright © 2015–2018 OpenZipkin. All rights reserved.