-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 Author: @franklinhu Fixes #66 URL: #66
- Loading branch information
Franklin Hu
committed
Jul 6, 2012
1 parent
54692f4
commit 3a32463
Showing
10 changed files
with
193 additions
and
47 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
/* | ||
* 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.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 | ||
} |
25 changes: 25 additions & 0 deletions
25
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,25 @@ | ||
/* | ||
* 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.query | ||
|
||
import com.twitter.zipkin.common.Endpoint | ||
|
||
/** | ||
* Extension of `Annotation` that also includes span/service information useful for query side | ||
* responses | ||
*/ | ||
case class TimelineAnnotation(timestamp: Long, value: String, host: Endpoint, spanId: Long, parentId: Option[Long], | ||
serviceName: String, spanName: String) |
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
/* | ||
* 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.query | ||
|
||
import com.twitter.zipkin.common.BinaryAnnotation | ||
|
||
/** | ||
* Query side struct that contains | ||
* - trace ID | ||
* - root span (or span closest to the root | ||
* - sorted list of `TimelineAnnotation`s | ||
* - binary annotations | ||
* for a particular trace | ||
*/ | ||
case class TraceTimeline(traceId: Long, rootSpanId: Long, annotations: Seq[TimelineAnnotation], | ||
binaryAnnotations: Seq[BinaryAnnotation]) |
66 changes: 66 additions & 0 deletions
66
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,66 @@ | ||
/* | ||
* 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.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