trait Interface[Out] {
def apply(operation: String, tags: Tag*): Out
def apply(activate: Boolean, operation: String, tags: Tag*): Out
def apply(parent: Span, operation: String, tags: Tag*): Out
def apply(parent: Span, activate: Boolean, operation: String, tags: Tag*): Out
def apply(parent: Option[Span], activate: Boolean, operation: String, tags: Map[String, TagValue]): Out
def map[R](f: Out => R): Interface[R]
}
Tracing[F0[_], F1[_]] defines instruments for building Interface[F1[A]] from F0[A] input.
There is auto derivation of Tracing instances for types that are both cats.Defer and cats.MonadError,
like EitherT[Eval, Throwable, ?] or IO.
Activating[F[_]] activates given span arround execution F.
/** Run `F ~> F` activating given span. */
trait Activating[F[_]] {
def apply(
span: Span,
onClose: Either[Throwable, Any] => Span => Unit = _ => _ => {}
): F ~> F
}There is auto derivation of Activating instances for types that are both cats.Defer and cats.MonadError,
like EitherT[Eval, Throwable, ?] or IO.
com.gihub.fehu.opentracing.trace provides interfaces built from Tracing[Later, Eval].
trace.now will execute inmediately while trace.later would wrap traced code in cats.Eval.
trace.now("op", "tag" -> "?") {
// do something
}Is provided for input F0[A] by an implicit class if there is non-ambiguous Tracing[F0[A], ?] instance.
IO {
???
}.tracing("IO")def activate[R](span: Span)(r: => R)(implicit tracer: Tracer): RDefined in package object com.gihub.fehu.opentracing, activate registers given span with Tracer's scope manager
before execution and closes the scope in the end.
Implicit syntax for types with instances of Activating.
IO {
...
}.activating(span)Implicit com.github.fehu.opentracing.SpanOps defines more logging syntax for Span.
The actor stores and processes scopes received inside TracedMessage. The received span can be accessed
with actorSpan() method (thread usnafe).
Extensions:
TracingActor.ActivatingThe actor activates and closes a scope around itsreceiveon receival ofTracedMessage.TracingActor.ChildSpanThe actor creates a child span on receival ofTracedMessage.TracingActor.ActivatingChildSpanThe actor creates a child span, activates and finishes it around itsreceiveon receival ofTracedMessage.TracingActor.AlwaysChildSpanThe actor creates a child span for any message, with no parent if the message didn't contain one.
Package com.github.fehu.opentracing.akka provides syntax for tracing messages sent to actors.
ask(actor, "Hello!")
.tracing("Introducing", tags =
...)An re-implementation of akka's LoggingAdapter (uses abstract override) that sends log enties both to original
adapter and currently active span.
Compiler plugin that traces implicit searches performed by scalac and reports them to local jaegertracing backend.
- Put to your
build.sbtaddCompilerPlugin("com.github.fehu" %% "opentracing-jaeger-scalac-implicits" % "0.1.0") - Run, for example, all-in-one jaeger backend with docker
- Compile your project
- See the traces at http://localhost:16686
git config core.hooksPath .git-hooks