Last active
August 27, 2018 20:41
-
-
Save henrikengstrom/a0a851109e31f9573b478aa8fbb3a930 to your computer and use it in GitHub Desktop.
Example of Cinnamon + DataDog OT integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the following setting to the application.conf to wire things up. | |
* | |
* cinnamon.opentracing { | |
* tracers = [datadog] | |
* | |
* datadog { | |
* factory-class = "sample.DataDogTracerFactory" | |
* } | |
* } | |
*/ | |
package sample | |
import com.lightbend.cinnamon.opentracing.TracerFactory | |
import com.typesafe.config.Config | |
import datadog.opentracing.DDTracer | |
import datadog.trace.common.DDTraceConfig | |
import io.opentracing.Tracer | |
class DatadogTracerFactory extends TracerFactory { | |
def create(config: Config): Tracer = { | |
val serviceName = config.getString("cinnamon.application") | |
val host = config.getString("cinnamon.opentracing.datadog.host") | |
val port = config.getInt("cinnamon.opentracing.datadog.port") | |
val traceConfig = new DDTraceConfig(serviceName) | |
traceConfig.setProperty(DDTraceConfig.AGENT_HOST, host) | |
traceConfig.setProperty(DDTraceConfig.AGENT_PORT, port.toString) | |
new DDTracer(traceConfig) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment