io.opentracing.contrib:opentracing-scala-akka

OpenTracing Instrumentation for Scala Akka

Лицензия

Лицензия

Категории

Категории

Scala Языки программирования Akka Контейнер Микросервисы Reactive libraries
Группа

Группа

io.opentracing.contrib
Идентификатор

Идентификатор

opentracing-scala-akka
Последняя версия

Последняя версия

0.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

io.opentracing.contrib:opentracing-scala-akka
OpenTracing Instrumentation for Scala Akka
Ссылка на сайт

Ссылка на сайт

https://github.com/opentracing-contrib/scala-akka
Система контроля версий

Система контроля версий

http://github.com/opentracing-contrib/scala-akka

Скачать opentracing-scala-akka

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-scala-akka/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-scala-akka</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-scala-akka/
implementation 'io.opentracing.contrib:opentracing-scala-akka:0.1.1'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-scala-akka/
implementation ("io.opentracing.contrib:opentracing-scala-akka:0.1.1")
'io.opentracing.contrib:opentracing-scala-akka:jar:0.1.1'
<dependency org="io.opentracing.contrib" name="opentracing-scala-akka" rev="0.1.1">
  <artifact name="opentracing-scala-akka" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-scala-akka', version='0.1.1')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-scala-akka" % "0.1.1"
[io.opentracing.contrib/opentracing-scala-akka "0.1.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
io.opentracing : opentracing-util jar 0.32.0
com.typesafe.akka : akka-actor_2.13 jar 2.5.23

provided (1)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.13.0

test (4)

Идентификатор библиотеки Тип Версия
io.opentracing : opentracing-util test-jar 0.32.0
io.opentracing : opentracing-mock jar 0.32.0
org.awaitility : awaitility-scala jar 3.1.6
org.scalatest : scalatest_2.13 jar 3.0.8

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status Released Version Apache-2.0 license

OpenTracing Scala Akka instrumentation

OpenTracing instrumentation for Scala Akka.

Installation

build.sbt

libraryDependencies += "io.opentracing.contrib" % "opentracing-scala-akka" % "VERSION"

Usage

Tracer registration

Instantiate tracer and register it with GlobalTracer:

val tracer: Tracer = ???
GlobalTracer.register(tracer)

Actor's Span propagation

User is responsible for finishing the Spans. For this to work, classes must inherit from TracedAbstractActor instead of Actor, and messages must be wrapped using TracedMessage.wrap():

class MyActor extends TracedAbstractActor {
  override def receive(): Receive = {
    case _: String =>
      sender().tell("ciao", self)
  }
}

val scope =  tracer.buildSpan("foo").startActive(true)

// scope.span() will be captured as part of TracedMessage.wrap(),
// and MyActor will receive the original 'myMessageObj` instance.
val future = ask(myActorRef, TracedMessage.wrap("hello"), timeout)
...
    
scope.close()
    
}

By default, TracedAbstractActor/TracedMessage use io.opentracing.util.GlobalTracer to activate and fetch the Span respectively, but it's possible to manually specify both the Tracer used to activate and the captured Span:

class MyActor(myTracer: Tracer) extends TracedAbstractActor {
  override def receive(): Receive = {
    case _: String =>
      // TracedAbstractActor.tracer() returns the Tracer being used,
      // either GlobalTracer 
      if (tracer().activeSpan() != null) {
        // Use the active Span, to set tags, create children, finish it, etc.
        tracer().activeSpan.finish()
      }
      ...
  }

  override def tracer(): Tracer = myTracer
}

val span = tracer.buildSpan("foo").start()
val future = ask(myActorRef, TracedMessage.wrap(span, "hello"), timeout);

License

Apache 2.0 License.

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Версии библиотеки

Версия
0.1.1
0.1.0
0.0.1