diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2018-02-10 01:32:53 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2018-02-10 01:33:19 +0100 |
commit | 5f748c1c74bb71ba4125644b2afec7d4e58bcb9f (patch) | |
tree | 1d516e55ce35d81762e761f2b7d5e299e64019b2 /kamon-core-tests/src | |
parent | fa342db5ec6e80227d559ee5ac9d0b11b9f0b453 (diff) | |
download | Kamon-5f748c1c74bb71ba4125644b2afec7d4e58bcb9f.tar.gz Kamon-5f748c1c74bb71ba4125644b2afec7d4e58bcb9f.tar.bz2 Kamon-5f748c1c74bb71ba4125644b2afec7d4e58bcb9f.zip |
apply metric tags on spans, even if the span is not sampled, fixes #513
Diffstat (limited to 'kamon-core-tests/src')
-rw-r--r-- | kamon-core-tests/src/test/scala/kamon/trace/SpanMetricsSpec.scala (renamed from kamon-core-tests/src/test/scala/kamon/trace/SpanMetrics.scala) | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kamon-core-tests/src/test/scala/kamon/trace/SpanMetrics.scala b/kamon-core-tests/src/test/scala/kamon/trace/SpanMetricsSpec.scala index 2a04024c..1dfe24a3 100644 --- a/kamon-core-tests/src/test/scala/kamon/trace/SpanMetrics.scala +++ b/kamon-core-tests/src/test/scala/kamon/trace/SpanMetricsSpec.scala @@ -21,9 +21,9 @@ import org.scalatest.{Matchers, WordSpecLike} import scala.util.control.NoStackTrace -class SpanMetrics extends WordSpecLike with Matchers with MetricInspection with Reconfigure { +class SpanMetricsSpec extends WordSpecLike with Matchers with MetricInspection with Reconfigure { - sampleAlways() + sampleNever() "Span Metrics" should { "be recorded for successful execution" in { @@ -57,6 +57,18 @@ class SpanMetrics extends WordSpecLike with Matchers with MetricInspection with Span.Metrics.ProcessingTime.valuesForTag("operation") shouldNot contain(operation) } + "allow specifying custom Span metric tags" in { + val operation = "span-with-custom-metric-tags" + buildSpan(operation) + .withMetricTag("custom-metric-tag-on-builder", "value") + .start() + .tagMetric("custom-metric-tag-on-span", "value") + .finish() + + Span.Metrics.ProcessingTime.valuesForTag("custom-metric-tag-on-builder") should contain("value") + Span.Metrics.ProcessingTime.valuesForTag("custom-metric-tag-on-span") should contain("value") + } + "be recorded if metrics are enabled by calling enableMetrics() on the Span" in { val operation = "span-with-re-enabled-metrics" buildSpan(operation) @@ -68,7 +80,7 @@ class SpanMetrics extends WordSpecLike with Matchers with MetricInspection with Span.Metrics.ProcessingTime.valuesForTag("operation") should contain(operation) } - "record correctly error latency and count" in { + "record error latency and count" in { val operation = "span-failure" val operationTag = "operation" -> operation |