Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
language: node_js

node_js:
- 5.2
- 4.2
- 0.12
- 0.10
- 0.8
- 0.6
Expand Down
36 changes: 20 additions & 16 deletions lib/_thrift/zipkinCore.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,31 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
namespace java com.twitter.zipkin.gen
namespace java com.twitter.zipkin.thriftjava
#@namespace scala com.twitter.zipkin.thriftscala
namespace rb Zipkin

//************** Collection related structs **************
#************** Collection related structs **************

// these are the annotations we always expect to find in a span
# these are the annotations we always expect to find in a span
const string CLIENT_SEND = "cs"
const string CLIENT_RECV = "cr"
const string SERVER_SEND = "ss"
const string SERVER_RECV = "sr"

// this represents a host and port in a network
# this represents a host and port in a network
struct Endpoint {
1: i32 ipv4,
2: i16 port // beware that this will give us negative ports. some conversion needed
3: string service_name // which service did this operation happen on?
2: i16 port # beware that this will give us negative ports. some conversion needed
3: string service_name # which service did this operation happen on?
}

// some event took place, either one by the framework or by the user
# some event took place, either one by the framework or by the user
struct Annotation {
1: i64 timestamp // microseconds from epoch
2: string value // what happened at the timestamp?
3: optional Endpoint host // host this happened on
1: i64 timestamp # microseconds from epoch
2: string value # what happened at the timestamp?
3: optional Endpoint host # host this happened on
4: optional i32 duration # how long did the operation take? microseconds
}

enum AnnotationType { BOOL, BYTES, I16, I32, I64, DOUBLE, STRING }
Expand All @@ -46,10 +48,12 @@ struct BinaryAnnotation {
}

struct Span {
1: i64 trace_id // unique trace id, use for all spans in trace
3: string name, // span name, rpc method for example
4: i64 id, // unique span id, only used for this span
5: optional i64 parent_id, // parent span id
6: list<Annotation> annotations, // list of all annotations/events that occured
8: list<BinaryAnnotation> binary_annotations // any binary annotations
1: i64 trace_id # unique trace id, use for all spans in trace
3: string name, # span name, rpc method for example
4: i64 id, # unique span id, only used for this span
5: optional i64 parent_id, # parent span id
6: list<Annotation> annotations, # list of all annotations/events that occured
8: list<BinaryAnnotation> binary_annotations # any binary annotations
9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers
}

90 changes: 63 additions & 27 deletions lib/_thrift/zipkinCore/zipkinCore_types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions lib/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
if (trace.parentSpanId !== undefined) {
restkinTrace.parent_span_id = trace.parentSpanId;
}

if (trace.debug !== undefined) {
restkinTrace.debug = trace.debug;
}

Array.prototype.forEach.call(annotations, function(ann, idx) {
annJson = {
Expand All @@ -73,6 +77,10 @@
};
}

if (ann.duration !== undefined) {
annJson.duration = ann.duration;
}

restkinTrace.annotations.push(annJson);
});

Expand Down Expand Up @@ -163,6 +171,7 @@
if (ann.annotationType === 'timestamp') {
ttype_args.timestamp = ann.value;
ttype_args.value = ann.name;
ttype_args.duration = ann.duration;
thriftAnn.push(new zipkinCore_types.Annotation(ttype_args));
} else {
ttype_args.key = ann.name;
Expand All @@ -177,6 +186,7 @@
name: trace.name,
id: trace.spanId,
parent_id: trace.parentSpanId,
debug: trace.debug,
annotations: thriftAnn,
binary_annotations: binaryAnn
});
Expand Down
Loading