Functional interface for opentracing and its implementation, based on cats.data.StateT
.
Requires cats-effect
3.
Supports scala 2.13
and 3.1
.
- Lifting values and effects through
pure
anddefer
. - Creating new spans (
extends Traced.Interface[F]
)
def apply[A](op: String, tags: Traced.Tag*)(fa: F[A]): F[A]
def spanResource(op: String, tags: Traced.Tag*): Resource[F, ActiveSpan]
def withParent(span: ActiveSpan | SpanContext): Interface[F]
def withoutParent: Interface[F]
- Accessing
currentSpan
throughTraced.SpanInterface[F]
def context: F[Option[SpanContext]]
def setOperation(op: String): F[Unit]
def setTag(tag: Traced.Tag): F[Unit]
def setTags(tags: Traced.Tag*): F[Unit]
def log(fields: (String, Any)*): F[Unit]
def log(event: String): F[Unit]
def setBaggageItem(key: String, value: String): F[Unit]
def getBaggageItem(key: String): F[Option[String]]
- Setting current span
def forceCurrentSpan(active: Traced.ActiveSpan): F[Traced.SpanInterface[F]]
/** Sets `active` span if no other is set. */
def recoverCurrentSpan(active: Traced.ActiveSpan): F[Traced.SpanInterface[F]]
- Transferring span context
def injectContext(context: SpanContext): Traced.Interface[F]
def injectContextFrom(carrier: Propagation#Carrier): Traced.Interface[F]
def extractContext[C <: Propagation#Carrier](carrier: C): F[Option[C]]
extends Traced[T[F, _]]
Defines tracing over transformer T[F, _]
, allowing to run and lift T[F, _] <~> F
def currentRunParams: T[F, Traced.RunParams]
def run[A](traced: T[F, A], params: Traced.RunParams): F[A]
def lift[A](ua: F[A]): T[F, A]
def mapK[G[_]](f: F ~> G): T[F, _] ~> T[G, _]
Running the transformer requires
- currently active span
- setup
- tracer
beforeStart
,justAfterStart
,beforeStop
hooks (Traced.Hooks
)- error logger
Default setups can be obtained at Traced.Setup.default(_: Tracer)
or
Jaeger
(inopentracing-scala-jaeger
) moduleNoOp
(inopentracing-scala-noop
) module
Support for
BinaryPropagation
TextMapPropagation
import io.github.fehu.opentracing.syntax._
TODO
Traced transformer implementation with underlying cats.data.StateT
.
Provides instances of most cats.effect
typeclasses and a Dispatcher
for TracedT[IO, A]
.
Other modules:
opentracing-scala-akka
-TracingActor
andask(actor, message).trace(...)
syntax.opentracing-scala-fs2
- Syntax extensions for fs2 atio.github.fehu.opentracing.syntax.FS2
.opentracing-scala-jaeger
- Setup helper forio.jaegertracing
.opentracing-scala-noop
- No-op setup.
Compiler plugin that traces implicit searches performed by scalac and reports them to local jaegertracing backend.
- Put to your
build.sbt
addCompilerPlugin("io.github.fehu" %% "opentracing-scalac-implicits-jaeger" % "0.1.4" cross CrossVersion.full)
- Run, for example, all-in-one jaeger backend with docker
- Compile your project
- See the traces at http://localhost:16686
Compiler plugin that traces implicit searches performed by scalac and reports them to local jaegertracing backend.
- Put to your
build.sbt
addCompilerPlugin("io.github.fehu" %% "scala3-compiler-tracing-jaeger" % "0.1.0")
- Since this is a research plugin,
you would need to use
NIGHTLY
scala compiler. You can find the version at maven.
Note: it doesn't work with graalvm
java.