Created
May 29, 2014 16:10
-
-
Save patforna/a77f9c02c39ec47914d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// service A | |
val tracer = ZipkinTracer.mk(host = "localhost", port = 9410, sampleRate = 1) | |
Trace.unwind { | |
Trace.pushTracerAndSetNextId(tracer) | |
Trace.recordRpcname("service-A", "GET") | |
Trace.record(Annotation.ServerRecv()) | |
// client call to service B (see below) | |
Trace.record(Annotation.ServerSend()) | |
} | |
// service A - client call to service B | |
Trace.unwind { | |
Trace.setId(Trace.nextId) | |
Trace.recordRpcname("service-B", "GET") | |
// set http headers | |
Trace.record(Annotation.ClientSend()) | |
// make http call | |
Trace.record(Annotation.ClientRecv()) | |
} | |
// service B | |
val tracer = ZipkinTracer.mk(host = "localhost", port = 9410, sampleRate = 1) | |
Trace.unwind { | |
Trace.pushTracer(tracer) | |
// parse HTTP headers | |
Trace.setId(TraceId(traceId, parentSpanId, sid, sampled, flags)) | |
Trace.recordRpcname("service-B", "GET") | |
Trace.record(Annotation.ServerRecv()) | |
// Trace.record("received") | |
// do some work | |
// Trace.record("sent") | |
Trace.record(Annotation.ServerSend()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment