All Projects → opentracing-contrib → scala-akka

opentracing-contrib / scala-akka

Licence: Apache-2.0 license
OpenTracing instrumentation for Scala Akka

Programming Languages

scala
5932 projects
shell
77523 projects

Projects that are alternatives of or similar to scala-akka

microservices-demo
A Monorepo Demoing Microservices Architecture
Stars: ✭ 36 (+125%)
Mutual labels:  opentracing
akka-contextual-actor
A really small library (just a few classes) which lets you trace your actors messages transparently propagating a common context together with your messages and adding the specified values to the MDC of the underlying logging framework.
Stars: ✭ 17 (+6.25%)
Mutual labels:  akka
alpakka-samples
Example projects building Reactive Integrations using Alpakka
Stars: ✭ 61 (+281.25%)
Mutual labels:  akka
lila-ws
Lichess' websocket server
Stars: ✭ 99 (+518.75%)
Mutual labels:  akka
protoactor-python
Proto Actor - Ultra fast distributed actors
Stars: ✭ 78 (+387.5%)
Mutual labels:  akka
akka-stream-kafka-template.g8
Template for Akka Streams & Kafka. Default impl: mirror a topic onto another one
Stars: ✭ 14 (-12.5%)
Mutual labels:  akka
ainterface
Runs an Erlang node on an ActorSystem of Akka.
Stars: ✭ 44 (+175%)
Mutual labels:  akka
java-jaxrs
OpenTracing Java JAX-RS instrumentation
Stars: ✭ 37 (+131.25%)
Mutual labels:  opentracing
opentracing-metrics-tracer
Exports cross-process metrics via OpenTracing to Prometheus.
Stars: ✭ 13 (-18.75%)
Mutual labels:  opentracing
braid-go
简单易用的微服务框架 | Ease used microservice framework
Stars: ✭ 34 (+112.5%)
Mutual labels:  opentracing
amas
Amas is recursive acronym for “Amas, monitor alert system”.
Stars: ✭ 77 (+381.25%)
Mutual labels:  opentracing
lightstep-tracer-ruby
The Lightstep distributed tracing library for Ruby
Stars: ✭ 14 (-12.5%)
Mutual labels:  opentracing
akka-cookbook
提供清晰、实用的Akka应用指导
Stars: ✭ 30 (+87.5%)
Mutual labels:  akka
lightstep-tracer-java
The Lightstep distributed tracing library for JRE
Stars: ✭ 46 (+187.5%)
Mutual labels:  opentracing
akka-pusher
Pusher meets Akka
Stars: ✭ 18 (+12.5%)
Mutual labels:  akka
java-grpc
OpenTracing Instrumentation for gRPC
Stars: ✭ 52 (+225%)
Mutual labels:  opentracing
akka-stream-mon
Throughput and latency monitoring for Akka Streams
Stars: ✭ 23 (+43.75%)
Mutual labels:  akka
khermes
A distributed fake data generator based in Akka.
Stars: ✭ 94 (+487.5%)
Mutual labels:  akka
jaeger-node
Out of the box distributed tracing for Node.js applications.
Stars: ✭ 66 (+312.5%)
Mutual labels:  opentracing
slicebox
Microservice for safe sharing and easy access to medical images
Stars: ✭ 18 (+12.5%)
Mutual labels:  akka

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].