如何使用playframework以zipkin显示跟踪数据

时间:2019-02-06 10:52:07

标签: scala playframework playframework-2.4 zipkin

我正在使用此命令docker run -d -p 9411:9411 openzipkin/zipkin通过docker运行zipkin,并在http://localhost:9411/zipkin/访问其服务器 我正在使用playframework-2.4,没有在zipkin ui中获得服务名称,现在也显示了跟踪数据,它显示了0 of 0 services

这是我的代码 application.conf

play.http.filters=arteciate.filters.Filters

trace {
  service-name = "zipkin-api-sample"

  zipkin {
    base-url = "http://localhost:9411"
    sample-rate = 0.1
  }
}

zipkin-trace-context {
  fork-join-executor {
    parallelism-factor = 20.0
    parallelism-max = 200
  }
}

play.modules.enabled  += "jp.co.bizreach.trace.play24.module.ZipkinModule"

build.sbt

"jp.co.bizreach" %% "play-zipkin-tracing-play24" % "1.2.0" 

class DirectUserController @Inject() (userRepository: UserRepositoryTrait, val tracer: ZipkinTraceService)
   extends Controller with ZipkinTraceImplicits {
   // Trace blocking action
  def test1 = Action { implicit request =>
    tracer.trace("sync"){ implicit traceData =>
      log.info("Hello World!")
      Ok(Json.obj("result" -> "ok"))
    }
  }
}

我先访问http://localhost:9000/direct-user/test1,然后访问http://localhost:9411,但没有显示跟踪数据 缺少什么吗?请帮助

0 个答案:

没有答案