diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/Adapter.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/Adapter.scala index 8373daacc5e..b78c910e861 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/Adapter.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/Adapter.scala @@ -32,7 +32,6 @@ trait Adapter { type binaryAnnotationType /* corresponds to com.twitter.zipkin.common.BinaryAnnotation */ type endpointType /* corresponds to com.twitter.zipkin.common.Endpoint */ type spanType /* corresponds to com.twitter.zipkin.common.Span */ - type traceSummaryType /* corresponds to com.twitter.zipkin.common.TraceSummary */ def apply(a: annotationType): Annotation def apply(a: Annotation): annotationType @@ -48,7 +47,4 @@ trait Adapter { def apply(s: spanType): Span def apply(s: Span): spanType - - def apply(t: traceSummaryType): TraceSummary - def apply(t: TraceSummary): traceSummaryType } diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala index e3b9643b4c8..6dfc95ffc33 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala @@ -15,8 +15,7 @@ */ package com.twitter.zipkin.adapter -import com.twitter.zipkin.common.Trace -import com.twitter.zipkin.query.{TraceCombo, TraceTimeline, TimelineAnnotation} +import com.twitter.zipkin.query._ /** * Adapter for query related structs @@ -25,6 +24,7 @@ trait QueryAdapter { type timelineAnnotationType /* corresponds to com.twitter.zipkin.query.TimelineAnnotation */ type traceTimelineType /* corresponds to com.twitter.zipkin.query.TraceTimeline */ type traceComboType /* corresponds to com.twitter.zipkin.query.TraceCombo */ + type traceSummaryType /* corresponds to com.twitter.zipkin.common.TraceSummary */ type traceType /* corresponds to com.twitter.zipkin.query.Trace */ def apply(t: timelineAnnotationType): TimelineAnnotation @@ -36,6 +36,9 @@ trait QueryAdapter { def apply(t: traceComboType): TraceCombo def apply(t: TraceCombo): traceComboType + def apply(t: traceSummaryType): TraceSummary + def apply(t: TraceSummary): traceSummaryType + def apply(t: traceType): Trace def apply(t: Trace): traceType } diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/common/Trace.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/query/Trace.scala similarity index 98% rename from zipkin-common/src/main/scala/com/twitter/zipkin/common/Trace.scala rename to zipkin-common/src/main/scala/com/twitter/zipkin/query/Trace.scala index d0dc50e57c5..3b6d982e0ac 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/common/Trace.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/query/Trace.scala @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.twitter.zipkin.common +package com.twitter.zipkin.query +import com.twitter.finagle.tracing.{Trace => FTrace} import com.twitter.logging.Logger +import com.twitter.zipkin.common.{BinaryAnnotation, Endpoint, Span} import java.nio.ByteBuffer import scala.collection.mutable -import com.twitter.finagle.tracing.{Trace => FTrace} -import com.twitter.zipkin.query.SpanTreeEntry /** * A chunk of time, between a start and an end. diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceCombo.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceCombo.scala index 71ee349e74d..0c2e5e06864 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceCombo.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceCombo.scala @@ -15,8 +15,6 @@ */ package com.twitter.zipkin.query -import com.twitter.zipkin.common.{Trace, TraceSummary} - object TraceCombo { def apply(trace: Trace): TraceCombo = { TraceCombo(trace, TraceSummary(trace), TraceTimeline(trace), trace.toSpanDepths) diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/common/TraceSummary.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceSummary.scala similarity index 95% rename from zipkin-common/src/main/scala/com/twitter/zipkin/common/TraceSummary.scala rename to zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceSummary.scala index 2ed791a831a..ec07bccae62 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/common/TraceSummary.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceSummary.scala @@ -14,9 +14,10 @@ * limitations under the License. * */ -package com.twitter.zipkin.common +package com.twitter.zipkin.query import scala.collection.Map +import com.twitter.zipkin.common.Endpoint object TraceSummary { diff --git a/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala index 72fda597f97..21173533c1d 100644 --- a/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala +++ b/zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala @@ -15,7 +15,7 @@ */ package com.twitter.zipkin.query -import com.twitter.zipkin.common.{Trace, Endpoint, BinaryAnnotation} +import com.twitter.zipkin.common.{Endpoint, BinaryAnnotation} object TraceTimeline { def apply(trace: Trace): Option[TraceTimeline] = { diff --git a/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonAdapter.scala b/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonAdapter.scala index 54af3435ea2..5bfb430ed1f 100644 --- a/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonAdapter.scala +++ b/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonAdapter.scala @@ -1,7 +1,7 @@ package com.twitter.zipkin.adapter import com.twitter.zipkin.common._ -import com.twitter.zipkin.common.json.{JsonTraceSummary, JsonBinaryAnnotation, JsonSpan} +import com.twitter.zipkin.common.json.{JsonBinaryAnnotation, JsonSpan} /** * Adapter to make common classes compatible with Jackson/Jerkson JSON generation @@ -12,7 +12,6 @@ object JsonAdapter extends Adapter { type binaryAnnotationType = JsonBinaryAnnotation type endpointType = Endpoint type spanType = JsonSpan - type traceSummaryType = JsonTraceSummary /* No change between JSON and common types */ def apply(a: annotationType): Annotation = a @@ -61,14 +60,6 @@ object JsonAdapter extends Adapter { s.annotations.sortWith((a,b) => a.timestamp < b.timestamp), s.binaryAnnotations.map(JsonAdapter(_))) } - - def apply(t: traceSummaryType): TraceSummary = { - TraceSummary(t.traceId.toLong, t.startTimestamp, t.endTimestamp, t.durationMicro, t.serviceCounts, t.endpoints) - } - - def apply(t: TraceSummary): traceSummaryType = { - JsonTraceSummary(t.traceId.toString, t.startTimestamp, t.endTimestamp, t.durationMicro, t.serviceCounts.toMap, t.endpoints) - } } diff --git a/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonQueryAdapter.scala b/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonQueryAdapter.scala index c63cab2c8ce..4bc17578f3c 100644 --- a/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonQueryAdapter.scala +++ b/zipkin-finatra/src/main/scala/com/twitter/zipkin/adapter/JsonQueryAdapter.scala @@ -1,8 +1,7 @@ package com.twitter.zipkin.adapter -import com.twitter.zipkin.common.Trace -import com.twitter.zipkin.common.json.{JsonTimelineAnnotation, JsonTrace, JsonTraceCombo, JsonTraceTimeline} -import com.twitter.zipkin.query.{TraceCombo, TraceTimeline, TimelineAnnotation} +import com.twitter.zipkin.common.json._ +import com.twitter.zipkin.query._ /** * JS doesn't like Longs so we need to convert them to strings @@ -11,6 +10,7 @@ object JsonQueryAdapter extends QueryAdapter { type timelineAnnotationType = JsonTimelineAnnotation type traceTimelineType = JsonTraceTimeline type traceComboType = JsonTraceCombo + type traceSummaryType = JsonTraceSummary type traceType = JsonTrace /* no change between json and common */ @@ -44,7 +44,7 @@ object JsonQueryAdapter extends QueryAdapter { def apply(t: traceComboType): TraceCombo = { TraceCombo( JsonQueryAdapter(t.trace), - t.traceSummary.map(JsonAdapter(_)), + t.traceSummary.map(JsonQueryAdapter(_)), t.traceTimeline.map(JsonQueryAdapter(_)), t.spanDepths) } @@ -53,11 +53,19 @@ object JsonQueryAdapter extends QueryAdapter { def apply(t: TraceCombo): traceComboType = { JsonTraceCombo( JsonQueryAdapter(t.trace), - t.traceSummary.map(JsonAdapter(_)), + t.traceSummary.map(JsonQueryAdapter(_)), t.traceTimeline.map(JsonQueryAdapter(_)), t.spanDepths) } + def apply(t: traceSummaryType): TraceSummary = { + TraceSummary(t.traceId.toLong, t.startTimestamp, t.endTimestamp, t.durationMicro, t.serviceCounts, t.endpoints) + } + + def apply(t: TraceSummary): traceSummaryType = { + JsonTraceSummary(t.traceId.toString, t.startTimestamp, t.endTimestamp, t.durationMicro, t.serviceCounts.toMap, t.endpoints) + } + /* json to common */ def apply(t: traceType): Trace = { throw new Exception("NOT IMPLEMENTED") diff --git a/zipkin-finatra/src/main/scala/com/twitter/zipkin/common/json/JsonTraceSummary.scala b/zipkin-finatra/src/main/scala/com/twitter/zipkin/common/json/JsonTraceSummary.scala index 5a898134303..dca173ae500 100644 --- a/zipkin-finatra/src/main/scala/com/twitter/zipkin/common/json/JsonTraceSummary.scala +++ b/zipkin-finatra/src/main/scala/com/twitter/zipkin/common/json/JsonTraceSummary.scala @@ -1,6 +1,7 @@ package com.twitter.zipkin.common.json -import com.twitter.zipkin.common.{Endpoint, TraceSummary} +import com.twitter.zipkin.common.Endpoint +import com.twitter.zipkin.query.TraceSummary object JsonTraceSummary { def apply(t: TraceSummary): JsonTraceSummary = diff --git a/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/App.scala b/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/App.scala index 6a3677fce62..bbf9e7e9a05 100644 --- a/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/App.scala +++ b/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/App.scala @@ -95,7 +95,7 @@ class App(config: ZipkinWebConfig, client: gen.ZipkinQuery.FinagledClient) exten case _ => { client.getTraceSummariesByIds(ids, adjusters).map { _.map { summary => - JsonAdapter(ThriftAdapter(summary)) + JsonQueryAdapter(ThriftQueryAdapter(summary)) } } } diff --git a/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftAdapter.scala b/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftAdapter.scala index a28c44a3055..d18ed8729d3 100644 --- a/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftAdapter.scala +++ b/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftAdapter.scala @@ -16,9 +16,9 @@ */ package com.twitter.zipkin.adapter +import com.twitter.util.Duration import com.twitter.zipkin.gen import com.twitter.zipkin.common._ -import com.twitter.util.Duration import java.util.concurrent.TimeUnit object ThriftAdapter extends Adapter { @@ -27,7 +27,6 @@ object ThriftAdapter extends Adapter { type binaryAnnotationType = gen.BinaryAnnotation type endpointType = gen.Endpoint type spanType = gen.Span - type traceSummaryType = gen.TraceSummary /* Annotation from Thrift */ def apply(a: annotationType): Annotation = { @@ -116,17 +115,4 @@ object ThriftAdapter extends Adapter { gen.Span(s.traceId, s.name, s.id, s.parentId, s.annotations.map { this(_) }, s.binaryAnnotations.map { this(_) }, s.debug) } - - /* TraceSummary from Thrift */ - def apply(t: traceSummaryType): TraceSummary = { - new TraceSummary(t.traceId, t.startTimestamp, t.endTimestamp, - t.durationMicro, t.serviceCounts, - t.endpoints.map(ThriftAdapter(_)).toList) - } - - /* TraceSummary to Thrift */ - def apply(t: TraceSummary): traceSummaryType = { - gen.TraceSummary(t.traceId, t.startTimestamp, t.endTimestamp, - t.durationMicro, t.serviceCounts, t.endpoints.map(ThriftAdapter(_))) - } } diff --git a/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala b/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala index 4b6dac1178a..7bc08baed20 100644 --- a/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala +++ b/zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala @@ -16,13 +16,13 @@ package com.twitter.zipkin.adapter import com.twitter.zipkin.gen -import com.twitter.zipkin.query.{TraceCombo, TraceTimeline, TimelineAnnotation} -import com.twitter.zipkin.common.Trace +import com.twitter.zipkin.query._ object ThriftQueryAdapter extends QueryAdapter { type timelineAnnotationType = gen.TimelineAnnotation type traceTimelineType = gen.TraceTimeline type traceComboType = gen.TraceCombo + type traceSummaryType = gen.TraceSummary type traceType = gen.Trace /* TimelineAnnotation from Thrift */ @@ -71,7 +71,7 @@ object ThriftQueryAdapter extends QueryAdapter { def apply(t: traceComboType): TraceCombo = { TraceCombo( ThriftQueryAdapter(t.`trace`), - t.`summary`.map(ThriftAdapter(_)), + t.`summary`.map(ThriftQueryAdapter(_)), t.`timeline`.map(ThriftQueryAdapter(_)), t.`spanDepths`.map(_.toMap)) } @@ -80,11 +80,24 @@ object ThriftQueryAdapter extends QueryAdapter { def apply(t: TraceCombo): traceComboType = { gen.TraceCombo( ThriftQueryAdapter(t.trace), - t.traceSummary.map(ThriftAdapter(_)), + t.traceSummary.map(ThriftQueryAdapter(_)), t.traceTimeline.map(ThriftQueryAdapter(_)), t.spanDepths) } + /* TraceSummary from Thrift */ + def apply(t: traceSummaryType): TraceSummary = { + new TraceSummary(t.traceId, t.startTimestamp, t.endTimestamp, + t.durationMicro, t.serviceCounts, + t.endpoints.map(ThriftAdapter(_)).toList) + } + + /* TraceSummary to Thrift */ + def apply(t: TraceSummary): traceSummaryType = { + gen.TraceSummary(t.traceId, t.startTimestamp, t.endTimestamp, + t.durationMicro, t.serviceCounts, t.endpoints.map(ThriftAdapter(_))) + } + /* Trace from Thrift */ def apply(t: traceType): Trace = { Trace(t.`spans`.map(ThriftAdapter(_))) diff --git a/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftAdapterSpec.scala b/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftAdapterSpec.scala index edd328a5215..229cc1dedb3 100644 --- a/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftAdapterSpec.scala +++ b/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftAdapterSpec.scala @@ -105,16 +105,5 @@ class ThriftAdapterSpec extends Specification with JMocker with ClassMocker { ThriftAdapter(noBinaryAnnotationsSpan) mustEqual Span(0, "name", 0, None, List(), Seq()) } } - - "convert TraceSummary" in { - "to thrift and back" in { - val expectedTraceSummary = TraceSummary(123, 10000, 10300, 300, Map("service1" -> 1), - List(Endpoint(123, 123, "service1"))) - val thriftTraceSummary = ThriftAdapter(expectedTraceSummary) - val actualTraceSummary = ThriftAdapter(thriftTraceSummary) - expectedTraceSummary mustEqual actualTraceSummary - } - } } - } diff --git a/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftQueryAdapterSpec.scala b/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftQueryAdapterSpec.scala new file mode 100644 index 00000000000..fc8e3e23a6a --- /dev/null +++ b/zipkin-scrooge/src/test/scala/com/twitter/zipkin/adapter/ThriftQueryAdapterSpec.scala @@ -0,0 +1,37 @@ +/* + * Copyright 2012 Twitter Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package com.twitter.zipkin.adapter + +import com.twitter.zipkin.common.Endpoint +import com.twitter.zipkin.query.TraceSummary +import org.specs.mock.{JMocker, ClassMocker} +import org.specs.Specification + +class ThriftQueryAdapterSpec extends Specification with JMocker with ClassMocker { + + "ThriftQueryAdapter" should { + "convert TraceSummary" in { + "to thrift and back" in { + val expectedTraceSummary = TraceSummary(123, 10000, 10300, 300, Map("service1" -> 1), + List(Endpoint(123, 123, "service1"))) + val thriftTraceSummary = ThriftQueryAdapter(expectedTraceSummary) + val actualTraceSummary = ThriftQueryAdapter(thriftTraceSummary) + expectedTraceSummary mustEqual actualTraceSummary + } + } + } +} diff --git a/zipkin-server/src/main/scala/com/twitter/zipkin/query/QueryService.scala b/zipkin-server/src/main/scala/com/twitter/zipkin/query/QueryService.scala index e572446238f..4e82557638b 100644 --- a/zipkin-server/src/main/scala/com/twitter/zipkin/query/QueryService.scala +++ b/zipkin-server/src/main/scala/com/twitter/zipkin/query/QueryService.scala @@ -23,14 +23,13 @@ import com.twitter.logging.Logger import com.twitter.ostrich.admin.Service import com.twitter.util.Future import com.twitter.zipkin.adapter.{ThriftQueryAdapter, ThriftAdapter} -import com.twitter.zipkin.common.TraceSummary import com.twitter.zipkin.gen import com.twitter.zipkin.query.adjusters.Adjuster import com.twitter.zipkin.storage.{Aggregates, TraceIdDuration, Index, Storage} import java.nio.ByteBuffer +import java.util.concurrent.atomic.AtomicBoolean import org.apache.thrift.TException import scala.collection.Set -import java.util.concurrent.atomic.AtomicBoolean /** * Able to respond to users queries regarding the traces. Usually does so @@ -183,7 +182,7 @@ class QueryService(storage: Storage, index: Index, aggregates: Aggregates, adjus storage.getTracesByIds(traceIds.toList).map { traces => traces.flatMap { trace => - TraceSummary(adjusters.foldLeft(trace)((t, adjuster) => adjuster.adjust(t))).map(ThriftAdapter(_)) + TraceSummary(adjusters.foldLeft(trace)((t, adjuster) => adjuster.adjust(t))).map(ThriftQueryAdapter(_)) } } } diff --git a/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/Adjuster.scala b/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/Adjuster.scala index 83d995575ed..2524ede886a 100644 --- a/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/Adjuster.scala +++ b/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/Adjuster.scala @@ -16,7 +16,7 @@ */ package com.twitter.zipkin.query.adjusters -import com.twitter.zipkin.common.Trace +import com.twitter.zipkin.query.Trace trait Adjuster { diff --git a/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjuster.scala b/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjuster.scala index 44510deaf10..eff9105fa15 100644 --- a/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjuster.scala +++ b/zipkin-server/src/main/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjuster.scala @@ -16,12 +16,11 @@ */ package com.twitter.zipkin.query.adjusters +import com.twitter.finagle.tracing.{Trace => FTrace} +import com.twitter.zipkin.common._ import com.twitter.zipkin.gen +import com.twitter.zipkin.query.{Trace, SpanTreeEntry} import scala.collection.Map -import com.twitter.zipkin.common._ -import com.twitter.finagle.tracing.{Trace => FTrace} -import com.twitter.zipkin.query.SpanTreeEntry - class TimeSkewAdjuster extends Adjuster { diff --git a/zipkin-server/src/main/scala/com/twitter/zipkin/storage/Storage.scala b/zipkin-server/src/main/scala/com/twitter/zipkin/storage/Storage.scala index 9aa98a88a1a..3ce69f7cc9b 100644 --- a/zipkin-server/src/main/scala/com/twitter/zipkin/storage/Storage.scala +++ b/zipkin-server/src/main/scala/com/twitter/zipkin/storage/Storage.scala @@ -16,8 +16,9 @@ */ package com.twitter.zipkin.storage -import com.twitter.zipkin.common.{Trace, Span} import com.twitter.util.{Duration, Future} +import com.twitter.zipkin.common.Span +import com.twitter.zipkin.query.Trace trait Storage { diff --git a/zipkin-server/src/main/scala/com/twitter/zipkin/storage/cassandra/CassandraStorage.scala b/zipkin-server/src/main/scala/com/twitter/zipkin/storage/cassandra/CassandraStorage.scala index d10019319e6..8741227ad6f 100644 --- a/zipkin-server/src/main/scala/com/twitter/zipkin/storage/cassandra/CassandraStorage.scala +++ b/zipkin-server/src/main/scala/com/twitter/zipkin/storage/cassandra/CassandraStorage.scala @@ -19,12 +19,13 @@ import com.twitter.zipkin.storage.Storage import com.twitter.util.{Duration, Future} import com.twitter.zipkin.gen import com.twitter.ostrich.stats.Stats -import com.twitter.cassie.{Order, Column, ColumnFamily, Keyspace} -import com.twitter.zipkin.common.{Trace, Span} +import com.twitter.cassie.{Order, Column, ColumnFamily} +import com.twitter.zipkin.common.Span import com.twitter.conversions.time._ import scala.collection.JavaConverters._ import com.twitter.zipkin.config.{CassandraConfig, CassandraStorageConfig} import com.twitter.zipkin.adapter.ThriftAdapter +import com.twitter.zipkin.query.Trace trait CassandraStorage extends Storage with Cassandra { diff --git a/zipkin-server/src/test/scala/com/twitter/zipkin/common/TraceSpec.scala b/zipkin-server/src/test/scala/com/twitter/zipkin/common/TraceSpec.scala index 9b488dd1458..dd7d2e83e3d 100644 --- a/zipkin-server/src/test/scala/com/twitter/zipkin/common/TraceSpec.scala +++ b/zipkin-server/src/test/scala/com/twitter/zipkin/common/TraceSpec.scala @@ -20,7 +20,7 @@ import org.specs.Specification import com.twitter.zipkin.gen import collection.mutable import java.nio.ByteBuffer -import com.twitter.zipkin.query.SpanTreeEntry +import com.twitter.zipkin.query.{Timespan, Trace, TraceSummary, SpanTreeEntry} import com.twitter.zipkin.adapter.{ThriftQueryAdapter, ThriftAdapter} class TraceSpec extends Specification { diff --git a/zipkin-server/src/test/scala/com/twitter/zipkin/query/QueryServiceSpec.scala b/zipkin-server/src/test/scala/com/twitter/zipkin/query/QueryServiceSpec.scala index 4ef8fb3e8cd..d43c9bee262 100644 --- a/zipkin-server/src/test/scala/com/twitter/zipkin/query/QueryServiceSpec.scala +++ b/zipkin-server/src/test/scala/com/twitter/zipkin/query/QueryServiceSpec.scala @@ -162,7 +162,7 @@ class QueryServiceSpec extends Specification with JMocker with ClassMocker { one(storage).getTracesByIds(List(traceId)) willReturn Future(List(trace1)) } - val ts = List(ThriftAdapter(TraceSummary(1, 100, 150, 50, Map("service1" -> 1), List(ep1)))) + val ts = List(ThriftQueryAdapter(TraceSummary(1, 100, 150, 50, Map("service1" -> 1), List(ep1)))) ts mustEqual qs.getTraceSummariesByIds(List(traceId), List())() } @@ -178,7 +178,7 @@ class QueryServiceSpec extends Specification with JMocker with ClassMocker { one(storage).getTracesByIds(List(traceId)) willReturn Future(List(trace1)) } val trace = ThriftQueryAdapter(trace1) - val summary = ThriftAdapter(TraceSummary(1, 100, 150, 50, Map("service1" -> 1), List(ep1))) + val summary = ThriftQueryAdapter(TraceSummary(1, 100, 150, 50, Map("service1" -> 1), List(ep1))) val timeline = TraceTimeline(trace1).map(ThriftQueryAdapter(_)) val combo = gen.TraceCombo(trace, Some(summary), timeline, Some(Map(666L -> 1))) Seq(combo) mustEqual qs.getTraceCombosByIds(List(traceId), List())() diff --git a/zipkin-server/src/test/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjusterSpec.scala b/zipkin-server/src/test/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjusterSpec.scala index 068510d36da..1f30279f689 100644 --- a/zipkin-server/src/test/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjusterSpec.scala +++ b/zipkin-server/src/test/scala/com/twitter/zipkin/query/adjusters/TimeSkewAdjusterSpec.scala @@ -20,7 +20,8 @@ import org.specs.Specification import org.specs.mock.{ClassMocker, JMocker} import scala.collection._ import com.twitter.zipkin.gen -import com.twitter.zipkin.common.{Endpoint, Trace, Annotation, Span} +import com.twitter.zipkin.common.{Endpoint, Annotation, Span} +import com.twitter.zipkin.query.Trace class TimeSkewAdjusterSpec extends Specification with JMocker with ClassMocker { val endpoint1 = Some(Endpoint(123, 123, "service")) diff --git a/zipkin-server/src/test/scala/com/twitter/zipkin/query/conversions/TraceTimelineSpec.scala b/zipkin-server/src/test/scala/com/twitter/zipkin/query/conversions/TraceTimelineSpec.scala index 126f03f81b4..264e0296d5e 100644 --- a/zipkin-server/src/test/scala/com/twitter/zipkin/query/conversions/TraceTimelineSpec.scala +++ b/zipkin-server/src/test/scala/com/twitter/zipkin/query/conversions/TraceTimelineSpec.scala @@ -15,15 +15,13 @@ */ package com.twitter.zipkin.query.conversions +import com.twitter.zipkin.adapter.ThriftAdapter +import com.twitter.zipkin.common._ +import com.twitter.zipkin.gen +import com.twitter.zipkin.query.{Trace, TimelineAnnotation, TraceTimeline} import org.specs.Specification import org.specs.mock.{ClassMocker, JMocker} -import com.twitter.zipkin.gen - -import scala.collection.JavaConversions._ import java.nio.ByteBuffer -import com.twitter.zipkin.adapter.ThriftAdapter -import com.twitter.zipkin.query.{TimelineAnnotation, TraceTimeline} -import com.twitter.zipkin.common._ class TraceTimelineSpec extends Specification with JMocker with ClassMocker {