aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test
diff options
context:
space:
mode:
authorBruno Filippone <bruno.filippone@yahoo.it>2016-08-19 13:30:12 +0100
committerDiego Parra <diegolparra@gmail.com>2016-08-19 09:30:12 -0300
commitb8a4dd0a57e5426935600a0f830c40c46f2b2ba6 (patch)
treebc6485e2b665385521296530bc88cf15ddf4081a /kamon-core/src/test
parentcf140b12f41c4872648e10d2445c8d60ac73349b (diff)
downloadKamon-b8a4dd0a57e5426935600a0f830c40c46f2b2ba6.tar.gz
Kamon-b8a4dd0a57e5426935600a0f830c40c46f2b2ba6.tar.bz2
Kamon-b8a4dd0a57e5426935600a0f830c40c46f2b2ba6.zip
+ core: allow accessing tags on TraceContext and Segment (#386)
Diffstat (limited to 'kamon-core/src/test')
-rw-r--r--kamon-core/src/test/scala/kamon/trace/TraceContextManipulationSpec.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/kamon-core/src/test/scala/kamon/trace/TraceContextManipulationSpec.scala b/kamon-core/src/test/scala/kamon/trace/TraceContextManipulationSpec.scala
index 2756eb30..58b51a73 100644
--- a/kamon-core/src/test/scala/kamon/trace/TraceContextManipulationSpec.scala
+++ b/kamon-core/src/test/scala/kamon/trace/TraceContextManipulationSpec.scala
@@ -63,6 +63,20 @@ class TraceContextManipulationSpec extends BaseKamonSpec("trace-metrics-spec") {
createdContext.name shouldBe "renamed-trace"
}
+ "allow tagging and untagging a trace" in {
+ val createdContext = Tracer.withContext(newContext("trace-before-rename")) {
+ Tracer.currentContext.addTag("trace-tag", "tag-1")
+ Tracer.currentContext
+ }
+
+ Tracer.currentContext shouldBe empty
+ createdContext.tags shouldBe Map("trace-tag" -> "tag-1")
+
+ createdContext.removeTag("trace-tag", "tag-1")
+
+ createdContext.tags shouldBe Map.empty
+ }
+
"allow creating a segment within a trace" in {
val createdContext = Tracer.withContext(newContext("trace-with-segments")) {
Tracer.currentContext.startSegment("segment-1", "segment-1-category", "segment-library")
@@ -82,5 +96,18 @@ class TraceContextManipulationSpec extends BaseKamonSpec("trace-metrics-spec") {
segment.name should be("new-segment-name")
}
}
+
+ "allow tagging and untagging a segment" in {
+ Tracer.withContext(newContext("trace-with-renamed-segment")) {
+ val segment = Tracer.currentContext.startSegment("segment-name", "segment-label", "segment-library")
+ segment.tags should be(Map.empty)
+
+ segment.addTag("segment-tag", "tag-1")
+ segment.tags should be(Map("segment-tag" -> "tag-1"))
+
+ segment.removeTag("segment-tag", "tag-1")
+ segment.tags should be(Map.empty)
+ }
+ }
}
} \ No newline at end of file