Skip to content

Commit

Permalink
WIP duration query
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Cole committed Nov 1, 2015
1 parent e53729f commit 55fbd8a
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions zipkin-thrift/src/main/thrift/com/twitter/zipkin/zipkinCore.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace java com.twitter.zipkin.thriftjava
namespace rb Zipkin

#************** Annotation.value **************
/*
/**
* The client sent ("cs") a request to a server. There is only one send per
* span. For example, if there's a transport error, each attempt can be logged
* as a WIRE_SEND annotation.
Expand All @@ -29,7 +29,7 @@ namespace rb Zipkin
* should also log the SERVER_ADDR.
*/
const string CLIENT_SEND = "cs"
/*
/**
* The client received ("cr") a response from a server. There is only one
* receive per span. For example, if duplicate responses were received, each
* can be logged as a WIRE_RECV annotation.
Expand All @@ -42,7 +42,7 @@ const string CLIENT_SEND = "cs"
* recorded separately as SERVER_ADDR when CLIENT_SEND is logged.
*/
const string CLIENT_RECV = "cr"
/*
/**
* The server sent ("ss") a response to a client. There is only one response
* per span. If there's a transport error, each attempt can be logged as a
* WIRE_SEND annotation.
Expand All @@ -58,7 +58,7 @@ const string CLIENT_RECV = "cr"
* recorded separately as CLIENT_ADDR when SERVER_RECV is logged.
*/
const string SERVER_SEND = "ss"
/*
/**
* The server received ("sr") a request from a client. There is only one
* request per span. For example, if duplicate responses were received, each
* can be logged as a WIRE_RECV annotation.
Expand All @@ -74,54 +74,54 @@ const string SERVER_SEND = "ss"
* should also log the CLIENT_ADDR.
*/
const string SERVER_RECV = "sr"
/*
/**
* Optionally logs an attempt to send a message on the wire. Multiple wire send
* events could indicate network retries. A lag between client or server send
* and wire send might indicate queuing or processing delay.
*/
const string WIRE_SEND = "ws"
/*
/**
* Optionally logs an attempt to receive a message from the wire. Multiple wire
* receive events could indicate network retries. A lag between wire receive
* and client or server receive might indicate queuing or processing delay.
*/
const string WIRE_RECV = "wr"
/*
/**
* Optionally logs progress of a (CLIENT_SEND, WIRE_SEND). For example, this
* could be one chunk in a chunked request.
*/
const string CLIENT_SEND_FRAGMENT = "csf"
/*
/**
* Optionally logs progress of a (CLIENT_RECV, WIRE_RECV). For example, this
* could be one chunk in a chunked response.
*/
const string CLIENT_RECV_FRAGMENT = "crf"
/*
/**
* Optionally logs progress of a (SERVER_SEND, WIRE_SEND). For example, this
* could be one chunk in a chunked response.
*/
const string SERVER_SEND_FRAGMENT = "ssf"
/*
/**
* Optionally logs progress of a (SERVER_RECV, WIRE_RECV). For example, this
* could be one chunk in a chunked request.
*/
const string SERVER_RECV_FRAGMENT = "srf"

#***** BinaryAnnotation.key where value = [1] and annotation_type = BOOL ******
/*
/**
* Indicates a client address ("ca") in a span. Most likely, there's only one.
* Multiple addresses are possible when a client changes its ip or port within
* a span.
*/
const string CLIENT_ADDR = "ca"
/*
/**
* Indicates a server address ("sa") in a span. Most likely, there's only one.
* Multiple addresses are possible when a client is redirected, or fails to a
* different server ip or port.
*/
const string SERVER_ADDR = "sa"

/*
/**
* Indicates the network context of a service recording an annotation with two
* exceptions.
*
Expand All @@ -142,14 +142,14 @@ struct Endpoint {
3: string service_name
}

/*
/**
* An annotation is similar to a log statement. It includes a host field which
* allows these events to be attributed properly, and also aggregatable.
*/
struct Annotation {
1: i64 timestamp // microseconds from epoch
2: string value // what happened at the timestamp?
/*
/**
* Always the host that recorded the event. By specifying the host you allow
* rollup of all events (such as client requests to a service) by IP address.
*/
Expand All @@ -159,7 +159,7 @@ struct Annotation {

enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING }

/*
/**
* Binary annotations are tags applied to a Span to give it context. For
* example, a binary annotation of "http.uri" could the path to a resource in a
* RPC call.
Expand All @@ -178,7 +178,7 @@ struct BinaryAnnotation {
1: string key,
2: binary value,
3: AnnotationType annotation_type,
/*
/**
* The host that recorded tag, which allows you to differentiate between
* multiple tags with the same key. There are two exceptions to this.
*
Expand All @@ -189,7 +189,7 @@ struct BinaryAnnotation {
4: optional Endpoint host
}

/*
/**
* A trace is a series of spans (often RPC calls) which form a latency tree.
*
* The root span is where trace_id = id and parent_id = Nil. The root span is
Expand All @@ -204,5 +204,19 @@ struct Span {
6: list<Annotation> annotations, # all annotations/events that occured, sorted by timestamp
8: list<BinaryAnnotation> binary_annotations # any binary annotations
9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers
/**
* Microseconds from epoch, usually taken from the first annotation. Ex.
* SERVER_RECV.timestamp
*/
10: optional i64 start_ts,
/**
* Duration of the span in microseconds, used to support queries. This value
* is usually derived by subtracting the last annotation from the first. For
* example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
*
* Note that this should be treated unsigned. i32 implies trace durations are
* not longer than 35.79 minutes.
*/
11: optional i32 duration
}

0 comments on commit 55fbd8a

Please sign in to comment.