diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-08-14 23:08:14 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-08-14 23:08:35 +0200 |
commit | 407d74e89acdd4dff5a887c1ae5793d63e9e7a2e (patch) | |
tree | 677f0a573dfe028f31826748609e315a4bfa36dd /kamon-core/src/main/scala/kamon/context/Codec.scala | |
parent | 3a8c0fa25f12230b27e943d1fffe07f814c650fe (diff) | |
download | Kamon-407d74e89acdd4dff5a887c1ae5793d63e9e7a2e.tar.gz Kamon-407d74e89acdd4dff5a887c1ae5793d63e9e7a2e.tar.bz2 Kamon-407d74e89acdd4dff5a887c1ae5793d63e9e7a2e.zip |
expose the identity provider through the Tracer
Diffstat (limited to 'kamon-core/src/main/scala/kamon/context/Codec.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/context/Codec.scala | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/kamon-core/src/main/scala/kamon/context/Codec.scala b/kamon-core/src/main/scala/kamon/context/Codec.scala index 957c3e26..50b7e93d 100644 --- a/kamon-core/src/main/scala/kamon/context/Codec.scala +++ b/kamon-core/src/main/scala/kamon/context/Codec.scala @@ -2,11 +2,13 @@ package kamon package context import com.typesafe.config.Config +import kamon.trace.IdentityProvider import kamon.util.DynamicAccess import org.slf4j.LoggerFactory + import scala.collection.mutable -class Codec(initialConfig: Config) { +class Codec(identityProvider: IdentityProvider, initialConfig: Config) { private val log = LoggerFactory.getLogger(classOf[Codec]) @volatile private var httpHeaders: Codec.ForContext[TextMap] = new Codec.HttpHeaders(Map.empty) @@ -19,14 +21,6 @@ class Codec(initialConfig: Config) { def reconfigure(config: Config): Unit = { httpHeaders = new Codec.HttpHeaders(readEntryCodecs("kamon.context.encoding.http-headers", config)) - - - // Kamon.contextCodec.httpHeaderExport(current) - // Kamon.exportContext(HTTP, context) - // Kamon.importContext(HTTP, textMap) - // Kamon.currentContext() - // Kamon.storeContext(context) - } private def readEntryCodecs[T](rootKey: String, config: Config): Map[String, Codec.ForEntry[T]] = { @@ -101,11 +95,11 @@ object Codec { context } } - } trait TextMap { + def get(key: String): Option[String] def put(key: String, value: String): Unit @@ -116,17 +110,21 @@ trait TextMap { object TextMap { class Default extends TextMap { - private val storage = mutable.Map.empty[String, String] + private val storage = + mutable.Map.empty[String, String] - override def get(key: String): Option[String] = storage.get(key) + override def get(key: String): Option[String] = + storage.get(key) - override def put(key: String, value: String): Unit = storage.put(key, value) + override def put(key: String, value: String): Unit = + storage.put(key, value) - override def values: Iterator[(String, String)] = storage.toIterator + override def values: Iterator[(String, String)] = + storage.toIterator } object Default { - def apply(): Default = new Default() + def apply(): Default = + new Default() } - }
\ No newline at end of file |