Skip to content
Permalink
Browse files

add misk-datadog (#1184)

  • Loading branch information...
mightyguava committed Sep 4, 2019
1 parent 7ec266f commit 70e53a58bcb6288662cdf2b26e8a7034136acba5
@@ -64,6 +64,7 @@ ext.dep = [
"okHttpMockWebServer": "com.squareup.okhttp3:mockwebserver:4.0.1",
"okio": "com.squareup.okio:okio:2.2.2",
"openTracing": "io.opentracing:opentracing-api:0.31.0",
"openTracingDatadog": "com.datadoghq:dd-trace-ot:0.32.0",
"openTracingJdbc": "io.opentracing.contrib:opentracing-jdbc:0.0.7",
"openTracingMock": "io.opentracing:opentracing-mock:0.31.0",
"openTracingOkHttp": "io.opentracing.contrib:opentracing-okhttp3:0.1.0",
@@ -81,6 +82,7 @@ ext.dep = [
"slf4jApi": "org.slf4j:slf4j-api:1.7.25",
"spotlessPlugin": "com.diffplug.spotless:spotless-plugin-gradle:3.23.0",
"tink": "com.google.crypto.tink:tink:1.2.0",
"tracingDatadog": "com.datadoghq:dd-trace-api:0.32.0",
"tracingJaeger": "com.uber.jaeger:jaeger-core:0.24.0",
"tracingZipkin": "io.opentracing.brave:brave-opentracing:0.29.0",
"vitess": "io.vitess:vitess-jdbc:3.0.0",
@@ -0,0 +1,18 @@
dependencies {
compile dep.tracingDatadog
compile dep.openTracingDatadog
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = 'gfm'
}
}
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-datadog
POM_NAME=misk-datadog
POM_DESCRIPTION=Misk module for Datadog
POM_PACKAGING=jar
@@ -0,0 +1,29 @@
package misk.tracking.backends.datadog

import datadog.trace.api.GlobalTracer
import misk.inject.KAbstractModule
import io.opentracing.Tracer
import io.opentracing.noop.NoopTracerFactory
import misk.logging.getLogger

/**
* Binds the datadog tracer to opentracing's [Tracer]
*/
class DatadogTracingBackendModule : KAbstractModule() {
override fun configure() {
// A DDTracer is installed by the DataDog Java agent, which runs before the app's main() method.
val tracer = GlobalTracer.get()
if (tracer is Tracer) {
bind<Tracer>().toInstance(tracer)
} else {
logger.error("A DDTracer was unexpectedly not installed by the java agent. "
+ "Are you missing this environment in your `dd_agent_env_whitelist` config in "
+ "app-manifest.yaml?")
bind(Tracer::class.java).toInstance(NoopTracerFactory.create())
}
}

companion object {
val logger = getLogger<DatadogTracingBackendModule>()
}
}
@@ -21,4 +21,5 @@ include ':samples:exemplar'
include ':samples:exemplarchat'
include ':misk-metrics-digester'
include ':misk-crypto'
include ':misk-inject'
include ':misk-inject'
include ':misk-datadog'

0 comments on commit 70e53a5

Please sign in to comment.
You can’t perform that action at this time.