aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main/scala/kamon/ReporterRegistry.scala
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2017-07-19 14:47:39 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2017-07-19 14:47:39 +0200
commitca6659c419e434b1b8caa6e9551420aad2230e77 (patch)
treefc8d8aa588a7d99a792cd3db23c8688f0ec6852b /kamon-core/src/main/scala/kamon/ReporterRegistry.scala
parent3076d7b7a499d1d7d3d2bc447d989e383dbb1b40 (diff)
downloadKamon-ca6659c419e434b1b8caa6e9551420aad2230e77.tar.gz
Kamon-ca6659c419e434b1b8caa6e9551420aad2230e77.tar.bz2
Kamon-ca6659c419e434b1b8caa6e9551420aad2230e77.zip
start writting Span.Real tests
Diffstat (limited to 'kamon-core/src/main/scala/kamon/ReporterRegistry.scala')
-rw-r--r--kamon-core/src/main/scala/kamon/ReporterRegistry.scala14
1 files changed, 11 insertions, 3 deletions
diff --git a/kamon-core/src/main/scala/kamon/ReporterRegistry.scala b/kamon-core/src/main/scala/kamon/ReporterRegistry.scala
index 8a36a7c7..f0d744e5 100644
--- a/kamon-core/src/main/scala/kamon/ReporterRegistry.scala
+++ b/kamon-core/src/main/scala/kamon/ReporterRegistry.scala
@@ -20,9 +20,11 @@ import java.util.concurrent.atomic.{AtomicLong, AtomicReference}
import java.util.concurrent._
import com.typesafe.config.Config
+import kamon.ReporterRegistry.SpanSink
import kamon.metric._
import kamon.trace.Span
-import kamon.util.{DynamicAccess, Registration}
+import kamon.trace.Span.FinishedSpan
+import kamon.util.{CallingThreadExecutionContext, DynamicAccess, Registration}
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, ExecutionContextExecutorService, Future}
@@ -42,6 +44,12 @@ trait ReporterRegistry {
def stopAllReporters(): Future[Unit]
}
+object ReporterRegistry {
+ private[kamon] trait SpanSink {
+ def reportSpan(finishedSpan: FinishedSpan): Unit
+ }
+}
+
sealed trait Reporter {
def start(): Unit
def stop(): Unit
@@ -56,7 +64,7 @@ trait SpanReporter extends Reporter {
def reportSpans(spans: Seq[Span.FinishedSpan]): Unit
}
-class ReporterRegistryImpl(metrics: MetricsSnapshotGenerator, initialConfig: Config) extends ReporterRegistry {
+class ReporterRegistryImpl(metrics: MetricsSnapshotGenerator, initialConfig: Config) extends ReporterRegistry with SpanSink {
private val logger = LoggerFactory.getLogger(classOf[ReporterRegistry])
private val registryExecutionContext = Executors.newScheduledThreadPool(2, threadFactory("kamon-reporter-registry"))
private val reporterCounter = new AtomicLong(0L)
@@ -212,7 +220,7 @@ class ReporterRegistryImpl(metrics: MetricsSnapshotGenerator, initialConfig: Con
}
}
- private[kamon] def reportSpan(span: Span.FinishedSpan): Unit = {
+ def reportSpan(span: Span.FinishedSpan): Unit = {
spanReporters.foreach { case (_, reporterEntry) =>
if(reporterEntry.isActive)
reporterEntry.buffer.offer(span)