diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-05-25 16:52:52 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-05-25 16:52:52 +0200 |
commit | a3d78ef61a277b0b62dc93daf84756dfa7625d3d (patch) | |
tree | 4fee7ce93ecfb4e32c7aaaa22efb75ed07c667f6 /kamon-core/src/main/scala/kamon/trace | |
parent | 22379d3f318b2cd3a4c995ff1c45bda33d935a46 (diff) | |
download | Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.tar.gz Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.tar.bz2 Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.zip |
trying to flatten out the structure and eliminate the notion of entitites
Diffstat (limited to 'kamon-core/src/main/scala/kamon/trace')
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/Span.scala | 31 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/Tracer.scala | 12 |
2 files changed, 18 insertions, 25 deletions
diff --git a/kamon-core/src/main/scala/kamon/trace/Span.scala b/kamon-core/src/main/scala/kamon/trace/Span.scala index 904c0a22..e64d8118 100644 --- a/kamon-core/src/main/scala/kamon/trace/Span.scala +++ b/kamon-core/src/main/scala/kamon/trace/Span.scala @@ -1,11 +1,8 @@ package kamon package trace -import kamon.metric.{Entity, RecorderRegistry} -import kamon.metric.instrument.DynamicRange - import scala.collection.JavaConverters._ -import kamon.util.{Clock, MeasurementUnit} +import kamon.util.Clock object Span { val MetricCategory = "span" @@ -29,7 +26,7 @@ object Span { class Span(spanContext: SpanContext, initialOperationName: String, initialTags: Map[String, String], startTimestampMicros: Long, - recorderRegistry: RecorderRegistry, reporterRegistry: ReporterRegistryImpl) extends io.opentracing.Span { + recorderRegistry: Any, reporterRegistry: ReporterRegistryImpl) extends io.opentracing.Span { private var isOpen: Boolean = true private val sampled: Boolean = spanContext.sampled @@ -156,17 +153,17 @@ class Span(spanContext: SpanContext, initialOperationName: String, initialTags: private def recordSpanMetrics(): Unit = { val elapsedTime = endTimestampMicros - startTimestampMicros - val entity = Entity(operationName, Span.MetricCategory, metricTags) - val recorder = recorderRegistry.getRecorder(entity) - - recorder - .histogram(Span.LatencyMetricName, MeasurementUnit.time.microseconds, DynamicRange.Default) - .record(elapsedTime) - - tags.get("error").foreach { errorTag => - if(errorTag != null && errorTag.equals(Span.BooleanTagTrueValue)) { - recorder.counter(Span.ErrorMetricName).increment() - } - } +// val entity = Entity(operationName, Span.MetricCategory, metricTags) +// val recorder = recorderRegistry.getRecorder(entity) + +// recorder +// .histogram(Span.LatencyMetricName, MeasurementUnit.time.microseconds, DynamicRange.Default) +// .record(elapsedTime) +// +// tags.get("error").foreach { errorTag => +// if(errorTag != null && errorTag.equals(Span.BooleanTagTrueValue)) { +// recorder.counter(Span.ErrorMetricName).increment() +// } +// } } }
\ No newline at end of file diff --git a/kamon-core/src/main/scala/kamon/trace/Tracer.scala b/kamon-core/src/main/scala/kamon/trace/Tracer.scala index 6bb5a252..ed42b810 100644 --- a/kamon-core/src/main/scala/kamon/trace/Tracer.scala +++ b/kamon-core/src/main/scala/kamon/trace/Tracer.scala @@ -7,12 +7,11 @@ import io.opentracing.propagation.{TextMap, Format} import io.opentracing.propagation.Format.Builtin.{BINARY, HTTP_HEADERS, TEXT_MAP} import io.opentracing.util.ThreadLocalActiveSpanSource import kamon.ReporterRegistryImpl -import kamon.metric.{Entity, EntityRecorder, RecorderRegistry} import kamon.util.Clock -class Tracer(metrics: RecorderRegistry, reporterRegistry: ReporterRegistryImpl) extends io.opentracing.Tracer { +class Tracer(metrics: Any, reporterRegistry: ReporterRegistryImpl) extends io.opentracing.Tracer { private val logger = Logger(classOf[Tracer]) - private val metricsRecorder = new TracerMetricsRecorder(metrics.getRecorder(Entity("tracer", "tracer", Map.empty))) + ///private val metricsRecorder = new TracerMetricsRecorder(metrics.getRecorder(Entity("tracer", "tracer", Map.empty))) private val activeSpanSource = new ThreadLocalActiveSpanSource() @volatile private var sampler: Sampler = Sampler.never @@ -118,15 +117,12 @@ class Tracer(metrics: RecorderRegistry, reporterRegistry: ReporterRegistryImpl) new SpanContext(traceID, traceID, 0L, sampler.decide(traceID), initialTags) } - metricsRecorder.createdSpans.increment() - new Span(spanContext, operationName, initialTags, startTimestampMicros, metrics, reporterRegistry) + //metricsRecorder.createdSpans.increment() + new Span(spanContext, operationName, initialTags, startTimestampMicros, ???, reporterRegistry) } private def createID(): Long = ThreadLocalRandom.current().nextLong() } - private class TracerMetricsRecorder(recorder: EntityRecorder) { - val createdSpans = recorder.counter("created-spans") - } } |