diff options
author | John St. John <jstjohn@users.noreply.github.com> | 2017-09-21 16:28:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-21 16:28:23 -0700 |
commit | 9b0bed19489dbbd59c52a77e9c0c080a880ca262 (patch) | |
tree | 74934c57133ada3cd84a5c8a702cdf2683e8881e /src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala | |
parent | 037f522caf47d70d674daba62b540a451542c64d (diff) | |
download | driver-core-1.0.1.tar.gz driver-core-1.0.1.tar.bz2 driver-core-1.0.1.zip |
Jstjohn/google stackdriver trace (#64)v1.0.1
Add app-level tracing to driver-core (https://www.pivotaltracker.com/story/show/151100422)
Diffstat (limited to 'src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala b/src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala new file mode 100644 index 0000000..4ea0e8c --- /dev/null +++ b/src/main/scala/xyz/driver/core/trace/SimpleSpanContextHandler.scala @@ -0,0 +1,17 @@ +package xyz.driver.core.trace + +import com.google.cloud.trace.SpanContextHandler +import com.google.cloud.trace.DetachedSpanContextHandle +import com.google.cloud.trace.core.{SpanContext, SpanContextHandle} + +@SuppressWarnings(Array("org.wartremover.warts.Var")) +class SimpleSpanContextHandler(rootSpan: SpanContext) extends SpanContextHandler { + private var currentSpanContext = rootSpan + + override def current(): SpanContext = currentSpanContext + + override def attach(context: SpanContext): SpanContextHandle = { + currentSpanContext = context + new DetachedSpanContextHandle(context) + } +} |