项目作者: reinno

项目描述 :
Jaeger Scala Integrations based on Jaeger Java Client
高级语言: Scala
项目地址: git://github.com/reinno/jaeger-scala-support.git
创建时间: 2018-08-22T05:06:47Z
项目社区:https://github.com/reinno/jaeger-scala-support

开源协议:Other

下载


jaeger-scala-support provide trace feature support for scala frameworks via Jaeger

sbt usage

  1. "io.github.reinno" %% "akka-jaeger-client" % <latest-version>

Integrations

Akka-Http

simple case

  1. import io.github.reinno.AkkaHttpTraceDirectives
  2. trait ExampleRoutes extends AkkaHttpTraceDirectives {
  3. override implicit val exec: ExecutionContext = system.dispatcher
  4. val exampleRoutes: Route = withTrace() {
  5. pathPrefix("hello") {
  6. pathEnd {
  7. get {
  8. complete("hello world")
  9. }
  10. }
  11. }
  12. }
  13. }

complete case

  1. import io.github.reinno.AkkaHttpTraceDirectives
  2. trait ExampleRoutes extends AkkaHttpTraceDirectives {
  3. override implicit val exec: ExecutionContext = system.dispatcher
  4. override protected lazy val tracer: Tracer = TraceSupport.defaultTracer("example")
  5. val exampleRoutes: Route = withTraceContext() {
  6. traceCtx => {
  7. pathPrefix("hellow") {
  8. pathEnd {
  9. get {
  10. complete("hello world")
  11. }
  12. }
  13. }
  14. }
  15. }
  16. }

start example

prerequest

install docker

start jaeger locally

  1. docker run -d -e \
  2. COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
  3. -p 5775:5775/udp \
  4. -p 6831:6831/udp \
  5. -p 6832:6832/udp \
  6. -p 5778:5778 \
  7. -p 16686:16686 \
  8. -p 14268:14268 \
  9. -p 9411:9411 \
  10. jaegertracing/all-in-one:latest

publish client to local

  1. sbt "project client" publishLocal
  2. sbt "project akka-http-client" publishLocal
  3. sbt "project spray-client" publishLocal

start example A(akka-http)

  1. sbt "project akka-http-example" run

start example B(spray)

  1. sbt "project spray-example" run

test example

  1. curl localhost:9001/users
  2. curl localhost:9002/users

check dashboard

open http://localhost:16686/search check traces