outtherelabs / brave-play

Play filter for Open Zipkin's Brave API

GitHub

Brave Play

Travis-CI Coverage Codacy Maven

This library provides a Play filter for Brave which is a Java distributed tracing implementation compatible with Zipkin.

Usage

Add the following to your build.sbt file to add the library to your application:

libraryDependencies += "com.outtherelabs" %% "brave-play" % "0.2.0"

And then use the Play filters API to define a class that has the filters you would like to use:

package filters

import com.outtherelabs.braveplay.filters.TracingServerFilter
import javax.inject.Inject
import play.api.http.HttpFilters

class MyFilters @Inject() (tracingServerFilter: TracingServerFilter) extends HttpFilters {
  val filters = Seq(tracingServerFilter)
}

Configuration

Add the following to application.conf to have play apply your filters:

tracing {
  server-name = "my-app-name"
  host = "http://localhost"
  port = 9411 // default port
  sample-rate-percentage = 0.10 // Fraction of requests to be sampled, in this case 10 percent
}

play.http.filters = "filters.MyFilters"