Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Trace to zipkin-common (part 1)
Moved TraceTimeline and TimelineAnnotation to zipkin-common, pulled out some thrift dependencies
- Loading branch information
Franklin Hu
committed
Jul 6, 2012
1 parent
fd23d96
commit 9780f5e
Showing
10 changed files
with
122 additions
and
47 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.twitter.zipkin.adapter | ||
|
||
import com.twitter.zipkin.query.{TraceTimeline, TimelineAnnotation} | ||
|
||
|
||
trait QueryAdapter { | ||
type timelineAnnotationType /* corresponds to com.twitter.zipkin.query.TimelineAnnotation */ | ||
type traceTimelineType /* corresponds to com.twitter.zipkin.query.TraceTimeline */ | ||
|
||
def apply(t: timelineAnnotationType): TimelineAnnotation | ||
def apply(t: TimelineAnnotation): timelineAnnotationType | ||
|
||
def apply(t: traceTimelineType): TraceTimeline | ||
def apply(t: TraceTimeline): traceTimelineType | ||
} |
6 changes: 6 additions & 0 deletions
6
zipkin-common/src/main/scala/com/twitter/zipkin/query/TimelineAnnotation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.twitter.zipkin.query | ||
|
||
import com.twitter.zipkin.common.Endpoint | ||
|
||
case class TimelineAnnotation(timestamp: Long, value: String, host: Endpoint, spanId: Long, parentId: Option[Long], | ||
serviceName: String, spanName: String) |
6 changes: 6 additions & 0 deletions
6
zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.twitter.zipkin.query | ||
|
||
import com.twitter.zipkin.common.BinaryAnnotation | ||
|
||
case class TraceTimeline(traceId: Long, rootSpanId: Long, annotations: Seq[TimelineAnnotation], | ||
binaryAnnotations: Seq[BinaryAnnotation]) |
51 changes: 51 additions & 0 deletions
51
zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.twitter.zipkin.adapter | ||
|
||
import com.twitter.zipkin.gen | ||
import com.twitter.zipkin.query.{TraceTimeline, TimelineAnnotation} | ||
|
||
object ThriftQueryAdapter extends QueryAdapter { | ||
type timelineAnnotationType = gen.TimelineAnnotation | ||
type traceTimelineType = gen.TraceTimeline | ||
|
||
/* TimelineAnnotation from Thrift */ | ||
def apply(t: timelineAnnotationType): TimelineAnnotation = { | ||
TimelineAnnotation( | ||
t.`timestamp`, | ||
t.`value`, | ||
ThriftAdapter(t.`host`), | ||
t.`spanId`, | ||
t.`parentId`, | ||
t.`serviceName`, | ||
t.`spanName`) | ||
} | ||
|
||
/* TimelineAnnotation to Thrift */ | ||
def apply(t: TimelineAnnotation): timelineAnnotationType = { | ||
gen.TimelineAnnotation( | ||
t.timestamp, | ||
t.value, | ||
ThriftAdapter(t.host), | ||
t.spanId, | ||
t.parentId, | ||
t.serviceName, | ||
t.spanName) | ||
} | ||
|
||
/* TraceTimeline from Thrift */ | ||
def apply(t: traceTimelineType): TraceTimeline = { | ||
TraceTimeline( | ||
t.`traceId`, | ||
t.`rootMostSpanId`, | ||
t.`annotations`.map { ThriftQueryAdapter(_) }, | ||
t.`binaryAnnotations`.map { ThriftAdapter(_) }) | ||
} | ||
|
||
/* TraceTimeline to Thrift */ | ||
def apply(t: TraceTimeline): traceTimelineType = { | ||
gen.TraceTimeline( | ||
t.traceId, | ||
t.rootSpanId, | ||
t.annotations.map { ThriftQueryAdapter(_) }, | ||
t.binaryAnnotations.map { ThriftAdapter(_) }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters