aboutsummaryrefslogtreecommitdiff
path: root/kamon-core-tests
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2018-10-29 17:45:57 +0100
committerGitHub <noreply@github.com>2018-10-29 17:45:57 +0100
commitf1c6ceffa22c59a463d6d8cd2ca77e2b440eb450 (patch)
tree5b871456e3d5ec72ed19a85484a28975efafc4a4 /kamon-core-tests
parentd0a0dfe886952ba924adacaabf85cb96ce5fe032 (diff)
downloadKamon-f1c6ceffa22c59a463d6d8cd2ca77e2b440eb450.tar.gz
Kamon-f1c6ceffa22c59a463d6d8cd2ca77e2b440eb450.tar.bz2
Kamon-f1c6ceffa22c59a463d6d8cd2ca77e2b440eb450.zip
Implement a module registry that supports loading from configuration (#559)
Diffstat (limited to 'kamon-core-tests')
-rw-r--r--kamon-core-tests/src/test/scala/kamon/KamonLifecycleSpec.scala6
-rw-r--r--kamon-core-tests/src/test/scala/kamon/trace/TracerSpec.scala26
2 files changed, 15 insertions, 17 deletions
diff --git a/kamon-core-tests/src/test/scala/kamon/KamonLifecycleSpec.scala b/kamon-core-tests/src/test/scala/kamon/KamonLifecycleSpec.scala
index b5d0425b..2a0af8c0 100644
--- a/kamon-core-tests/src/test/scala/kamon/KamonLifecycleSpec.scala
+++ b/kamon-core-tests/src/test/scala/kamon/KamonLifecycleSpec.scala
@@ -10,17 +10,17 @@ import org.scalatest.{Matchers, WordSpec}
import org.scalatest.concurrent.Eventually
import org.scalatest.time.SpanSugar._
-class KamonLifecycleSpec extends WordSpec with Matchers with Eventually{
+class KamonLifecycleSpec extends WordSpec with Matchers with Eventually {
"the Kamon lifecycle" should {
- "keep the JVM running if reporters are running" in {
+ "keep the JVM running if modules are running" in {
val process = Runtime.getRuntime.exec(createProcessCommand("kamon.KamonWithRunningReporter"))
Thread.sleep(5000)
process.isAlive shouldBe true
process.destroyForcibly().waitFor(5, TimeUnit.SECONDS)
}
- "let the JVM stop after all reporters are stopped" in {
+ "let the JVM stop after all modules are stopped" in {
val process = Runtime.getRuntime.exec(createProcessCommand("kamon.KamonWithTemporaryReporter"))
Thread.sleep(2000)
process.isAlive shouldBe true
diff --git a/kamon-core-tests/src/test/scala/kamon/trace/TracerSpec.scala b/kamon-core-tests/src/test/scala/kamon/trace/TracerSpec.scala
index f325d1d1..b52303f6 100644
--- a/kamon-core-tests/src/test/scala/kamon/trace/TracerSpec.scala
+++ b/kamon-core-tests/src/test/scala/kamon/trace/TracerSpec.scala
@@ -29,7 +29,7 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
"the Kamon tracer" should {
"construct a minimal Span that only has a operation name" in {
- val span = tracer.buildSpan("myOperation").start()
+ val span = Kamon.buildSpan("myOperation").start()
val spanData = inspect(span)
spanData.operationName() shouldBe "myOperation"
@@ -38,7 +38,7 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
"pass the operation name and tags to started Span" in {
- val span = tracer.buildSpan("myOperation")
+ val span = Kamon.buildSpan("myOperation")
.withMetricTag("metric-tag", "value")
.withMetricTag("metric-tag", "value")
.withTag("hello", "world")
@@ -60,16 +60,16 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
"not have any parent Span if there is no Span in the current context and no parent was explicitly given" in {
- val span = tracer.buildSpan("myOperation").start()
+ val span = Kamon.buildSpan("myOperation").start()
val spanData = inspect(span)
spanData.context().parentID shouldBe IdentityProvider.NoIdentifier
}
"automatically take the Span from the current Context as parent" in {
- val parent = tracer.buildSpan("myOperation").start()
+ val parent = Kamon.buildSpan("myOperation").start()
val child = Kamon.withSpan(parent) {
- tracer.buildSpan("childOperation").asChildOf(parent).start()
+ Kamon.buildSpan("childOperation").asChildOf(parent).start()
}
val parentData = inspect(parent)
@@ -78,9 +78,9 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
"ignore the span from the current context as parent if explicitly requested" in {
- val parent = tracer.buildSpan("myOperation").start()
+ val parent = Kamon.buildSpan("myOperation").start()
val child = Kamon.withSpan(parent) {
- tracer.buildSpan("childOperation").ignoreParentFromContext().start()
+ Kamon.buildSpan("childOperation").ignoreParentFromContext().start()
}
val childData = inspect(child)
@@ -88,7 +88,7 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
"allow overriding the start timestamp for a Span" in {
- val span = tracer.buildSpan("myOperation").withFrom(Instant.EPOCH.plusMillis(321)).start()
+ val span = Kamon.buildSpan("myOperation").withFrom(Instant.EPOCH.plusMillis(321)).start()
val spanData = inspect(span)
spanData.from() shouldBe Instant.EPOCH.plusMillis(321)
}
@@ -101,7 +101,7 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
val remoteParent = Span.Remote(createSpanContext())
- val childData = inspect(tracer.buildSpan("local").asChildOf(remoteParent).start())
+ val childData = inspect(Kamon.buildSpan("local").asChildOf(remoteParent).start())
childData.context().traceID shouldBe remoteParent.context.traceID
childData.context().parentID shouldBe remoteParent.context.parentID
@@ -114,10 +114,10 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
val sampledRemoteParent = Span.Remote(createSpanContext().copy(samplingDecision = SamplingDecision.Sample))
val notSampledRemoteParent = Span.Remote(createSpanContext().copy(samplingDecision = SamplingDecision.DoNotSample))
- tracer.buildSpan("childOfSampled").asChildOf(sampledRemoteParent).start().context()
+ Kamon.buildSpan("childOfSampled").asChildOf(sampledRemoteParent).start().context()
.samplingDecision shouldBe(SamplingDecision.Sample)
- tracer.buildSpan("childOfNotSampled").asChildOf(notSampledRemoteParent).start().context()
+ Kamon.buildSpan("childOfNotSampled").asChildOf(notSampledRemoteParent).start().context()
.samplingDecision shouldBe(SamplingDecision.DoNotSample)
}
@@ -129,7 +129,7 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
val unknownSamplingRemoteParent = Span.Remote(createSpanContext().copy(samplingDecision = SamplingDecision.Unknown))
- tracer.buildSpan("childOfSampled").asChildOf(unknownSamplingRemoteParent).start().context()
+ Kamon.buildSpan("childOfSampled").asChildOf(unknownSamplingRemoteParent).start().context()
.samplingDecision shouldBe(SamplingDecision.Sample)
Kamon.reconfigure(previousConfig)
@@ -137,6 +137,4 @@ class TracerSpec extends WordSpec with Matchers with SpanBuilding with SpanInspe
}
- val tracer: Tracer = Kamon
-
}