GithubHelp home page GithubHelp logo

isabella232 / akka-stream-trace Goto Github PK

View Code? Open in Web Editor NEW

This project forked from findhotel/akka-stream-trace

0.0 0.0 0.0 23 KB

dapper tracing implementation for akka-streams and akka-http using htrace and zipkin

Scala 100.00%

akka-stream-trace's Introduction

Gitter Chat Maven Central

Htrace extension for akka http and akka streams

prerequistes:

docker run -d -p 9411:9411 -p 9410:9410 openzipkin/zipkin

running the examples:

sbt examples/run

then choose 1 for http example or 2 for streaming example

The http example will bind to port 8080. point your browesr to localhost:8080/frontend in order to initiate a request.

Getting Started:

The main advantage of using this library is that it eliminates the need for manual calls for logs and lets you focus on the right things, when things break you will still have a clear view into your applications, you can always add anontations later.

add the dependecy:

resolvers +=  Resolver.sonatypeRepo("releases") //akka-stream-trace sources 
resolvers += "Apache OSS Snapshots" at "https://repository.apache.org/content/groups/snapshots/" // htrace sources
libraryDependencies += "net.findhotel" %% "akka-stream-trace" % "0.3"

The first part of integrating the library is adding a config file, here's a basic example:

htrace{
  span.receiver.classes = org.apache.htrace.impl.ZipkinSpanReceiver
  sampler.classes = org.apache.htrace.core.AlwaysSampler
  zipkin.scribe.hostname = "localhost"
}

This example tells htrace to use the zipkin receiver, samples all traces and points htrace to localhost as the span server.

now we have to configure the actor system to use the tracing dispatcher

  implicit val as = ActorSystem()
  val set = ActorMaterializerSettings(as)
  //We want to use the tracing dispatcher
  .withDispatcher("tracing-dispatcher")
  implicit val met = ActorMaterializer(set)

if you are using akka-http you are done, if this is a akka-streams applications add this call before your call to run:

val s = StreamTracer.tracer.newScope("compute")
Source.fromIterator(() => (1 to 100).toIterator).runFold(0)(_ +_)

don't forget to close the scope after the call to run

s.close()

this method is shown in here https://github.com/FindHotel/akka-stream-trace/blob/master/modules/examples/src/main/scala/BasicStreamExample.scala

Videos:

Tracing akka streams (scalar 2017):

Tracing Akka Steams with htrach

akka-stream-trace's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.