Traces the provided synchronous operation Option[Span] => A op, using the provided traceName and annotations.
Traces the provided synchronous operation Option[Span] => A op, using the provided traceName and annotations.
This function expects that there is a parent Span in scope. If there is even is a Span in scope, it may not be used as a Parent Span if it does not have the proper ids, namely a span id and a trace id. In this case, a new scope with the given name and new ids will be used and it will not have a parent id.
If the in scope ZipkinServiceLike does not provide a Span for the in scope parentSpan Span (or if it fails) your function will be handed a None. Also, note that if the ZipkinServiceLike does not provide a Span in the timeout duration timeout, then your function will be handed a None.
Note, the Span given to your function should not be mutated to affect tracing. It is a deep copy anyways, so there will be no effect.
TracedOp("sleepy", "boom" -> "shakalaka") { maybeSpan => Thread.sleep(2000.millis.toMillis) 3 }
the name for the span used for tracing
variable list of annotations to send for tracing in the beginning (after the client sent annotation)
the function that will take a Option[Span] and produce an [A]
Traces the provided synchronous operation Option[Span] => A op, using the provided traceName and annotations.
Traces the provided synchronous operation Option[Span] => A op, using the provided traceName and annotations. The Option[Span] parameter is so that you can pass the span details toother systems in your A-producing function. Note that this function expects the a Tuple2 result, where the second element in the pair is a Seq[(String, String)] set of annotations that you might want to use in order to set final annotations on the span.
This function expects that there is a parent Span in scope. If there is even is a Span in scope, it may not be used as a Parent Span if it does not have the proper ids, namely a span id and a trace id. In this case, a new scope with the given name and new ids will be used and it will not have a parent id.
If the in scope ZipkinServiceLike does not provide a Span for the in scope parentSpan Span (or if it fails) your function will be handed a None. Also, note that if the ZipkinServiceLike does not provide a Span in the timeout duration timeout, then your function will be handed a None.
Note, the Span given to your function should not be mutated to affect tracing. It is a deep copy anyways, so there will be no effect.
TracedOp.endAnnotations("sleepy", "boom" -> "shakalaka") { maybeSpan => Thread.sleep(2000.millis.toMillis) (3, Seq("finished-with" -> "3")) // end annotations }
the name for the span used for tracing
variable list of annotations to send for tracing in the beginning (after the client sent annotation)
the function that will take a Option[Span] and produce an [A]
The simplest kind synchronous tracing; traces the provided operation f
using the provided traceName and annotations.
The simplest kind synchronous tracing; traces the provided operation f
using the provided traceName and annotations.
This function expects that there is a parent Span in scope. Even if there is a Span in scope, it may not be used as a Parent Span if it does not have the proper ids, namely a span id and a trace id. In this case, a new scope with the given name and new ids will be used and it will not have a parent id.
If you do not need to have access to the generated Span used for tracing this operation, this is the best synchronous tracing method to use, as it does not block the current thread in waiting for the Span to be produced by the in-scope ZipkinServiceLike
Example:
TracedOp.simple("sleepy", "boom" -> "shakalaka") { Thread.sleep(2000.millis.toMillis) 3 }
the name for the span used for tracing
variable list of annotations to send for tracing in the beginning (after the client sent annotation)
the function that will take an [A]
Duration of timeout to wait for the in-scope ZipkinServiceLike to produce a Span for sync tracing purposes
TraceOp companion object that sets a 50 millisecond timeout