Skip to content

Instantly share code, notes, and snippets.

@DanielMSchmidt
Last active December 7, 2017 21:53
Show Gist options
  • Save DanielMSchmidt/f9a7ceb60c654cdc04b3f2e4cac11366 to your computer and use it in GitHub Desktop.
Save DanielMSchmidt/f9a7ceb60c654cdc04b3f2e4cac11366 to your computer and use it in GitHub Desktop.
const tracer = ... // As previously defined
tracer.scoped(() => {
// Previous example
const previousResult = 404;
tracer.scoped(() => {
const id = tracer.createChildId();
tracer.setId(id);
tracer.recordAnnotation(new zipkin.Annotation.ClientSend());
tracer.recordAnnotation(new zipkin.Annotation.Rpc("My Child Span"));
fetch("https://http.cat/" + previousResult).then(res => res.json()).then(result => {
tracer.scoped(() => {
tracer.setId(id);
tracer.recordAnnotation(new zipkin.Annotation.ClientRecv());
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment