Custom reporters

It’s possible to create OpenTracing compatible tracers programmatically, by providing a Cinnamon TracerFactory that creates the Tracer directly.

For example, the LightStep Tracer can be used by implementing a TracerFactory such as:

import com.lightbend.cinnamon.logging.LoggingProvider
import com.lightbend.cinnamon.opentracing.TracerFactory
import com.typesafe.config.Config
import io.opentracing.Tracer

/**
 * Optional parameters for an implementation of a TracerFactory (in this specific order):
 *
 * @param configPath      path to section in config for the tracer, e.g. `cinnamon.opentracing.lightstep`
 * @param config          the configuration for this `ActorSystem`
 * @param loggingProvider a Cinnamon `LoggingProvider`
 */
class LightStepTracerFactory(configPath: String, config: Config, loggingProvider: LoggingProvider)
  extends TracerFactory {

  def create(): Tracer = {
    new com.lightstep.tracer.jre.JRETracer(
      new com.lightstep.tracer.shared.Options.OptionsBuilder()
        .withAccessToken("{your_access_token}")
        .build()
    )
  }
}

And then configuring Cinnamon to use this tracer:

cinnamon.opentracing {
  tracers = [lightstep]

  lightstep {
    factory-class = "sample.LightStepTracerFactory"
  }
}