Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Move Trace to zipkin-common (part 1) #66

Closed
wants to merge 3 commits into from

2 participants

@franklinhu

Moved TraceTimeline and TimelineAnnotation to zipkin-common, pulled out
some thrift dependencies

Franklin Hu added some commits
Franklin Hu Move Trace to zipkin-common (part 1)
Moved TraceTimeline and TimelineAnnotation to zipkin-common, pulled out
some thrift dependencies
9780f5e
Franklin Hu Add license headers f2a5ed9
...ala/com/twitter/zipkin/query/TimelineAnnotation.scala
((5 lines not shown))
+ * 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
+
+case class TimelineAnnotation(timestamp: Long, value: String, host: Endpoint, spanId: Long, parentId: Option[Long],

Let's add a comment here and on the TraceTimeline that explains what it is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@johanoskarsson

+1 except the above nit

Franklin Hu Add some doc 745f5aa
@franklinhu franklinhu closed this pull request from a commit
Franklin Hu 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
19355eb
@franklinhu franklinhu closed this in 19355eb
@franklinhu franklinhu referenced this pull request from a commit
Franklin Hu 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
3a32463
@franklinhu franklinhu referenced this pull request from a commit
Franklin Hu Squashed commit of the following:
commit a567041ba5f955bd2c4bd27f1341e3149dfdf3dd
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 16:38:08 2012 -0700

    Add some doc

commit c521a3dc7c58aa15b6bf1223748acba83799a616
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 16:26:28 2012 -0700

    Order results

commit 26dcb283ddb51aeb88a112aa311a33c82fb5fadd
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 15:52:40 2012 -0700

    Working getTraces w/ some simple tests

commit cb5fb596a3ae0752fab2937bd29538a53823ee81
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 15:52:19 2012 -0700

    Fix interface, make returned counts optional

commit cd7c8730ea02da037b2c8be116f94d99e4e1dcac
Merge: 228674a 2cc3378
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 10:44:37 2012 -0700

    Merge branch 'master' of github.com:twitter/zipkin into complex_query_backend

commit 228674a1af698e9bbdba9c24bd499d68e0ab5a7b
Merge: bdeb2f0 7ed569a
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 28 10:24:59 2012 -0700

    Merge branch 'master' of github.com:twitter/zipkin into complex_query_backend

commit bdeb2f04d7be39810010168b6ee7d784d4d89d82
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 27 13:27:02 2012 -0700

    Add generic getTraceIds method to query thrift interface

commit 238816e
Author: Franklin Hu <franklin@twitter.com>
Date:   Fri Aug 24 13:30:21 2012 -0700

    Fix NPE when querying for time annotations

    Author: @franklinhu
    Fixes #121
    URL: #121

commit 15d4cee
Author: Franklin Hu <franklin@twitter.com>
Date:   Fri Aug 24 10:26:25 2012 -0700

    Trace Finatra app

    Author: @franklinhu
    Fixes #123
    URL: #123

commit b758814
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 23 16:40:51 2012 -0700

    Backbone (part 2)

    - Remove some Rails-isms in JS files
    - Backbone-ify index querying

    Author: @franklinhu
    Fixes #122
    URL: #122

commit 59999c7
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 23 16:39:07 2012 -0700

    Add license headers

    Author: @franklinhu
    Fixes #119
    URL: #119

commit edb79fd
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 23 16:38:47 2012 -0700

    Fix query service error counter

    Author: @franklinhu
    Fixes #120
    URL: #120

commit f6fbc6a
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Aug 23 16:23:31 2012 -0700

    Ensure that we can receive Scribe messages with endline at the end

    Some codestyle changes and removed a few lines of unused code in my quest to
    find the right code to test :)

    Author: @johanoskarsson
    Fixes #117
    URL: #117

commit 03247bb
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 23 13:51:26 2012 -0700

    Backbone (part 1)

    Initial changes to move the front end JS to Backbone
    - Span, Service Name models
    - Index page service name, span name populated through Backbone models/views
    - Some Finatra side changes to accommodate Backbone

    Author: @franklinhu
    Fixes #118
    URL: #118

commit 0bdcd9f
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Aug 22 11:44:38 2012 -0700

    Added Centos6 quick start & fixed that bin/sbt '[' annoyance

    First sane draft of a quick start on centos6
    Also fixed the SBT '[' thing as
    it's been bugging me (#30)

    Author: @glynd
    Fixes #116
    URL: #116

commit 0d8ec15
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 20 12:54:49 2012 -0700

    Upgrade to Finatra 0.2.4

    - Includes controller method level stats (time for each request)

    Author: @franklinhu
    Fixes #115
    URL: #115

commit a976e48
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 20 10:31:10 2012 -0700

    Update docs for local development

    - Fix previously incorrect documentation on local development for UI

    Author: @franklinhu
    Fixes #114
    URL: #114

commit dea7d78
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 14 09:58:00 2012 -0700

    Improve local js,css development

    Making changes to js,css can be painful with a packaged jar since a
    compilation is needed to repackage any new changes. This change allows
    for the paths to the static resources to be configured at runtime.
    While developing locally, you can then set the prefix to bypass the jar
    and the browser will resolve it on your local filesystem.

    Author: @franklinhu
    Fixes #112
    URL: #112

commit 9c5c96b
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Aug 14 09:57:17 2012 -0700

    Bump Twitter lib versions

    - Cassie `0.22.1` to `0.23.0`
    - Finagle `5.3.1` to `5.3.5`
    - Ostrich `8.2.1` to `8.2.3`
    - Util `5.3.1` to `5.3.6`
    - Cassie `Cluster` constructor change for new lib

    Author: @franklinhu
    Fixes #111
    URL: #111

commit 32dd9c6
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 13 18:27:46 2012 -0700

    Remove annotations in ScroogeThriftCodec

    Author: @franklinhu
    Fixes #113
    URL: #113

commit 94460a5
Author: Jerry Li <jli@twitter.com>
Date:   Mon Aug 13 17:31:16 2012 -0700

    Upgrade Gemfile in zipkin-web

    Author: @jerryli9876
    Fixes #107
    URL: #107

commit 9e266b0
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 13 10:44:24 2012 -0700

    Fixup Scribe script, add a localhost Finatra config

    - Fix issue in collector.sh (referencing the wrong JAR)
    - Add config file for Finatra which uses the localhost zookeeper and
      doesn't override the queryhost

    Author: @glynd
    Fixes #106
    URL: #106

commit d580d87
Author: Jerry Li <jli@twitter.com>
Date:   Fri Aug 10 10:31:26 2012 -0700

    Preliminary Version of formatting emails using Mustache

    Made all the line processing simpler by using only lists

    Removed standardization
    stuff for now in ServiceNameList

    using mustachejava to format all email service
    reports

    Author: @jerryli9876
    Fixes #102
    URL: #102

commit 3d12d9c
Author: Jerry Li <jli@twitter.com>
Date:   Thu Aug 9 17:59:09 2012 -0700

    Make traces exist gem

    - Added has-sampled.rb, which uses tracesExist
    - Bumped zipkin-query to 0.1.0
    -
    Added tracesExist to thrift files and generated ruby code

    Author: @jerryli9876
    Fixes #105
    URL: #105

commit 4795387
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 9 11:23:30 2012 -0700

    zipkin-finatra fixes

    - Bump to Finatra `0.2.3`
    - Fix /api/query response
    - Fix timestamp text on query results

    Author: @franklinhu
    Fixes #104
    URL: #104

commit 45d3c06
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Aug 8 10:27:21 2012 -0700

    Add finatra start script

    Author: @franklinhu
    Fixes #103
    URL: #103

commit 684b4fe
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Aug 6 13:02:18 2012 -0700

    Trace spec refactor

    - Move Thrift conversion spec to ThriftQueryAdapter
    - Replace thrift/scrooge dependencies with comparable common
      dependencies
    - Move TraceSpec to zipkin-common

    Author: @franklinhu
    Fixes #101
    URL: #101

commit 6449ab7
Author: Jerry Li <jli@twitter.com>
Date:   Mon Aug 6 11:33:33 2012 -0700

    Added tracesExist support

    traceExist queries the database to find which traces from a list are actually in the database

    Author: @jerryli9876
    Fixes #100
    URL: #100

commit bc52d61
Author: Jerry Li <jli@twitter.com>
Date:   Thu Aug 2 17:34:03 2012 -0700

    Add endpoints. Made clients to postprocess hadoop jobs

    Made postprocessing framework, so that it is straightforward to add new
    endpoints. Made postprocessors which write to servers and files.

    Author: @jerryli9876
    Fixes #92
    URL: #92

commit cd48498
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 2 16:23:36 2012 -0700

    Remove Trace dependency from Storage

    Rather than returning a Trace from Storage, return a sequence of Spans and let
    the QueryService deal

    Author: @franklinhu
    Fixes #98
    URL: #98

commit 4025721
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Aug 2 16:14:08 2012 -0700

    Grep by annotations value. Useful for finding particular trace ids

    Author: @johanoskarsson
    Fixes #97
    URL: #97

commit 4c4c3f0
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Aug 2 15:21:46 2012 -0700

    Added this gem by mistake. Removing

commit 78a6fec
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Aug 2 15:20:22 2012 -0700

    Use the new finagle-thrift version with flags.

    Author: @johanoskarsson
    Fixes #95
    URL: #95

commit 9914ff4
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Aug 2 11:06:48 2012 -0700

    Fix time skew adjustment for client sends with 127.0.0.1 as host IP

    Author: @franklinhu
    Fixes #94
    URL: #94

commit cd65332
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Aug 1 14:13:58 2012 -0700

    Uncomment spec assertion

    As @mosesn mentioned in #90

    Author: @franklinhu
    Fixes #93
    URL: #93

commit 9980e41
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Aug 1 14:13:07 2012 -0700

    Trace: merge spans and sort by timestamp by default

    Author: @franklinhu
    Fixes #91
    URL: #91

commit 391aef2
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jul 31 12:12:24 2012 -0700

    Common refactor

    - Move `Trace`, `TraceSummary` from `common` package to `query` since
      they are only used in the query service.
    - Cleanup from the move

    Author: @franklinhu
    Fixes #89
    URL: #89

commit a2f42a0
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jul 31 10:27:24 2012 -0700

    QueryService refactor

    Author: @franklinhu
    Fixes #88
    URL: #88

commit c79a7fc
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 30 14:22:05 2012 -0700

    Bump Twitter lib versions, cleanup

    - Upgrade Twitter library versions
      - cassie: `0.22.0` -> `0.22.1`
      - finagle: `5.1.0` -> `5.3.1`
      - ostrich: `8.1.0` -> `8.2.1`
      - util: `5.2.0` -> `5.3.1`
    - Clean up `Project.scala` slightly

    Author: @franklinhu
    Fixes #87
    URL: #87

commit a75e854
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Mon Jul 30 13:48:47 2012 -0700

    Adds ability to receive debug flag from Finagle. If the debug flag is set on a span we ensure it is stored. This allows developers to force tracing on a request

    Author: @johanoskarsson
    Fixes #86
    URL: #86

commit a5e1ee3
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Jul 26 13:07:29 2012 -0700

    Replace the word submit on the lookup page with Find traces. That explains what will happens better.

    Author: @johanoskarsson
    Fixes #85
    URL: #85

commit f6e8543
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jul 25 11:57:20 2012 -0700

    Bump finatra

    - Bump Finatra version to 0.2.1
    - Fixes for Finatra changes

    Author: @franklinhu
    Fixes #84
    URL: #84

commit 2082fc8
Author: Jerry Li <jli@twitter.com>
Date:   Wed Jul 25 10:06:19 2012 -0700

    Modified scripts to fix minor bug

    Modifications to run_job.sh amd run_all_jobs.sh and SpanSource to allow us to
    run jobs remotely

    Author: @jerryli9876
    Fixes #79
    URL: #79

commit f4e1f72
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jul 24 10:07:11 2012 -0700

    Bump master to 0.3.0-SNAPSHOT

    Author: @franklinhu
    Fixes #83
    URL: #83

commit 58c3851
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 23 17:52:00 2012 -0700

    Add release doc, changelog

    Author: @franklinhu
    Fixes #82
    URL: #82

commit baaea73
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 23 13:27:19 2012 -0700

    Misc finatra fixes

    - Fix span details modal on static trace page
    - Remove unnecessary code
    - Sort span annotations by timestamp when dumping to json

    Author: @franklinhu
    Fixes #80
    URL: #80

commit a70cb0e
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jul 19 16:37:27 2012 -0700

    Fix merge from forks

    Author: @franklinhu
    Fixes #78
    URL: #78

commit f7a2850
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jul 19 11:14:47 2012 -0700

    Fix 404 in README (link to zipkin.thrift)

    Under the "Zipkin query daemon" there is a link to:
    https://github.com/twitter/zipkin/blob/master/zipkin-thrift/src/main/thrift/zipkin.thrift
    but I'm guessing this should now be:
    https://github.com/twitter/zipkin/blob/master/zipkin-thrift/src/main/thrift/zipkinQuery.thrift

    Author: @shawnps
    Fixes #76
    URL: #76

commit 27987b5
Author: Jerry Li <jli@twitter.com>
Date:   Thu Jul 19 10:43:14 2012 -0700

    Added WhaleReport and spec

    WhaleReport finds all traces w/ 500 Internal Server Errors and finds all spans
    in those traces with retries and/or timeouts

    Author: @jerryli9876
    Fixes #71
    URL: #71

commit dd25b80
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Jul 19 10:01:45 2012 -0700

    Readding counts by category.

    Useful for finding out when to turn of b3 but also for figuring out the hdfs
    issue

    Author: @johanoskarsson
    Fixes #77
    URL: #77

commit b1c8dfa
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jul 18 13:06:39 2012 -0700

    Finatra

    Port `zipkin-web` from Rails to Scala (using Finatra) for a variety of reasons
    - Simpler deployment (all JVM-based)
    - Simpler web logic (no need to replicate all the common data classes)
    - Operational transparency

    Changes:
    - JsonAdapter and JsonQueryAdapter
    - necessary since Javascript doesn't really support Longs, so we need
      to convert them to strings

    Author: @franklinhu
    Fixes #75
    URL: #75

commit 72900b6
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jul 18 10:22:36 2012 -0700

    Remove the compression and deserializing annotations. They lead to way too many annotations and make it hard to see what is actually going on.

    Author: @johanoskarsson
    Fixes #74
    URL: #74

commit 25a311d
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jul 17 18:20:34 2012 -0700

    Add static trace rendering page

    * Add export button on trace page
    * Add /static to allow users to paste in the exported JSON to render
      the trace page

    Author: @franklinhu
    Fixes #73
    URL: #73

commit 3d2a9c2
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Tue Jul 17 18:16:19 2012 -0700

    Add duration to annotations.

    Useful for timing blocks of code or other operations that don't warrant a full
    Span.

    Author: @johanoskarsson
    Fixes #72
    URL: #72

commit cfba24b
Author: Jerry Li <jli@twitter.com>
Date:   Tue Jul 17 17:31:07 2012 -0700

    Script run jobs

    Move error code to WhaleReport, fixed typo in run.sh and added comments to
    run_job.sh

    Author: @jerryli9876
    Fixes #70
    URL: #70

commit 7b48932
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 16 11:00:17 2012 -0700

    fixed zipkin-web to actually return values from servers

    Ruby 1.9.3 fixed a problem where do loops were sometimes not returning their
    last value. However, for compatibility with 1.9.2, the with_transport do loops
    need their last value to be assigned to a variable with a greater scope than the
    do loop, ie to be initialized outside of the do loop and then assigned within.
    Either the necessary ruby version should be specified in the documentation, or
    this fix needs to be pulled in.

    Author: @mosesn
    Fixes #68
    URL: #68

commit db5487c
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 9 10:01:32 2012 -0700

    Move trace (part 2)

    * Move Trace to zipkin-common
    * Pull out thrift dependencies into zipkin-scrooge

    Author: @franklinhu
    Fixes #67
    URL: #67

commit 3a32463
Author: Franklin Hu <franklin@twitter.com>
Date:   Fri Jul 6 16:38:27 2012 -0700

    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

commit 54692f4
Author: Jerry Li <jli@twitter.com>
Date:   Fri Jul 6 15:05:41 2012 -0700

    Removed leading space

    ProcessPopularKeys added a leading space; removed it

    Author: @jerryli9876
    Fixes #65
    URL: #65

commit 8eb2005
Author: Jerry Li <jli@twitter.com>
Date:   Fri Jul 6 13:28:54 2012 -0700

    Run hadoop jobs

    Renamed job-runner and made Processor accept both popular annotations and
    popular keys

    Author: @jerryli9876
    Fixes #64
    URL: #64

commit 1807e47
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jul 5 17:22:19 2012 -0700

    Move TraceSummary to zipkin-common

    Author: @franklinhu
    Fixes #62
    URL: #62

commit 8528eac
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jul 3 17:56:36 2012 -0700

    Move ZooKeeper configs/client service to common

    Author: @franklinhu
    Fixes #61
    URL: #61

commit 286b027
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Tue Jul 3 17:12:36 2012 -0700

    Add a note that it is possible to not use Scribe at all

    Author: @johanoskarsson
    Fixes #59
    URL: #59

commit 8399069
Author: Jerry Li <jli@twitter.com>
Date:   Mon Jul 2 17:23:47 2012 -0700

    Removed client name buisness from code

    Simplified stuff to remove the need to store client names in SpanServiceName

    Author: @jerryli9876
    Fixes #60
    URL: #60

commit b8314e4
Author: Jerry Li <jli@twitter.com>
Date:   Mon Jul 2 13:37:10 2012 -0700

    Added ExpensiveEndpoints and test files
    ExpensiveEndpoints : Per service call, finds the average duration

    ExpensiveEndoints : per service call, finds average run time
    Util.scala :
    Changed repeatSpan to allow it to model API level requests

    Author: @jerryli9876
    Fixes #58
    URL: #58

commit 8f6bdcd
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Mon Jul 2 11:43:03 2012 -0700

    Add some traces for our own query process

    Lazy val the rootmost span, no point in regenerating that

    Author: @johanoskarsson
    Fixes #56
    URL: #56

commit d01971f
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jul 2 10:13:11 2012 -0700

    Scribe cleanup

    * Move scribe reference from ZipkinCollectorConfig to zipkin-scribe
    * Move scribe categories config to ScribeZipkinCollectorConfig

    Author: @franklinhu
    Fixes #55
    URL: #55

commit fad482d
Author: Jerry Li <jli@twitter.com>
Date:   Fri Jun 29 13:27:30 2012 -0700

    Made preprocessing more complete

    Preprocessed : Now only merges spans
    FindNames : Finds client side and service
    names
    FindIDtoNames : Finds (id, service name)
    Other files modified to
    accommodate these

    Author: @jerryli9876
    Fixes #54
    URL: #54

commit ff71364
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 28 13:45:14 2012 -0700

    zipkin-web: Remove filtering of empty spans

    Remove filtering of empty spans to fix UI side bug for case where span only has
    a KV annotation

    Author: @franklinhu
    Fixes #53
    URL: #53

commit c169c8c
Author: Jerry Li <jli@twitter.com>
Date:   Thu Jun 28 13:28:11 2012 -0700

    Hadoop jobs

    Added a bunch of scalding queries and tests

    DependencyTree : Finds out how often services call each other throughout the entire system

    MemcacheRequest : Find out how often each service does memcache accesses

    MostCommonCalls : For each service finds the services that it most commonly calls

    PopularKeys : Per service, find the 100 most common keys used to annotate spans involving that service

    Timeouts : Find which service calls timeout the most

    WorstRuntimes : Obtain the IDs and the durations of the one hundred service calls which take the longest per service

    sources/Preprocessed : Preprocesses the data by merging different pieces of the same span and finds the best client side and service names possible, if any exist

    sources/Util : Added a collection of useful functions throughout the library

    Author: @jerryli9876
    Fixes #47
    URL: #47

commit dd9ca09
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jun 27 10:36:01 2012 -0700

    Add static query linking

    * Show 'link' button for linking
    * pushState the query params so going 'back' from a trace page loads
      the original search results

    Author: @franklinhu
    Fixes #51
    URL: #51

commit ff04826
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jun 27 09:54:21 2012 -0700

    Add annotation suggestions support in UI

    * Upgrade to zipkin-query v0.0.3
    * Add autocomplete dropdown with suggestions if they exist

    Author: @franklinhu
    Fixes #50
    URL: #50

commit aacd84d
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 26 16:57:59 2012 -0700

    Update zipkin-query gem

    * Generate Ruby with new Thrift changes
    * Bump version number

    Author: @franklinhu
    Fixes #49
    URL: #49

commit 27b0f50
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 26 15:45:39 2012 -0700

    Add StatsProcessor

    Author: @franklinhu
    Fixes #48
    URL: #48

commit 641ab4c
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 26 15:44:53 2012 -0700

    Top annotations

    Add collector and query support for adding "top annotation" data that may be
    computed offline

    * New collector endpoints
      * `storeTopAnnotations`
      * `storeTopKeyValueAnnotations`
    * New query endpoints
      * `getTopAnnotations`
      * `getTopKeyValueAnnotations`

    Author: @franklinhu
    Fixes #46
    URL: #46

commit d1618c6
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 26 15:43:58 2012 -0700

    Misc fixes

    * Cleaner summing of scribe message size
    * Remove unnecessary `GlobalSampler` dependency from `WriteQueue`,
      `WriteQueueWorker`

    Author: @franklinhu
    Fixes #40
    URL: #40

commit 9f11f96
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Tue Jun 26 15:33:22 2012 -0700

    Clarify the Scribe setup documentation.

    No need to push for the Twitter Scribe version

    Author: @johanoskarsson
    Fixes #45
    URL: #45

commit cd9c4e0
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jun 25 14:26:20 2012 -0700

    Add syntax highlighting to README code blocks

    Author: @franklinhu
    Fixes #44
    URL: #44

commit af5a1ee
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jun 25 14:25:41 2012 -0700

    Remove unnecessary github api call

    Including the string "Fixes #..." automatically closes a pull request

    Author: @franklinhu
    Fixes #43
    URL: #43

commit bb89394
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jun 25 13:58:42 2012 -0700

    Fix build.properties output package

    Sets correct package com.twitter.zipkin for build.properties. This
    fixes the issue where curling host:post/server_info.txt returns
    unknown values.

    Author: @franklinhu
    Fixes #42
    URL: #42

commit a08e4fc
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jun 20 12:34:23 2012 -0700

    Make changes needed to build on travis-ci

    Adds the travis-ci maven repositories for faster downloads.

    Reduces sbt memory used so it doesn't try to grab more than the travis-ci nodes have. If this poses a problem elsewhere we can just have a specific travis-ci sbt script.

    Author: @johanoskarsson
    Pull Request: #41
    URL: #41

commit bb3902c
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 19 15:17:08 2012 -0700

    Bump versions, Cassandra fix

    * Bump to
      * finagle 5.1.0
      * ostrich 8.1.0
      * util 5.2.0
    * Only close a cassie keyspace if it has not already been closed

    Author: @franklinhu
    Pull Request: #39
    URL: #39

commit dc22e0e
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jun 18 16:53:36 2012 -0700

    Misc changes

    * Add metric for batch size (how many entries are added to the write queue)
    * Remove `OstrichProcessor` from default processors

    Author: @franklinhu
    Pull Request: #35
    URL: #35

commit 7602367
Author: Franklin Hu <franklin@twitter.com>
Date:   Fri Jun 15 15:56:26 2012 -0700

    Pull out msg from Thrift struct in ScribeCollectorService

    Move code that pulls out the base64 encoded Span from the Thrift struct back to
    the CollectorService since putting the entire Thrift struct in the write queue
    causes major GC regression.

    Author: @franklinhu
    Pull Request: #34
    URL: #34

commit b9e485a
Author: Franklin Hu <franklin@twitter.com>
Date:   Fri Jun 15 12:57:51 2012 -0700

    Add package dist name for zipkin-scribe

    Author: @franklinhu
    Pull Request: #33
    URL: #33

commit 074a775
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Jun 14 16:59:14 2012 -0700

    Add two simple startup scripts for the collector and query daemons

    Author: @johanoskarsson
    Pull Request: #32
    URL: #32

commit 9e5c223
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 14 16:28:33 2012 -0700

    Modularize remaining collector Scribe dependencies

    This change makes it easier to extend the collector to accept different
    input types. Doing so would only require writing an `Adapter` and a
    `ProcessFilter`.

    Changes:
    - Add `ProcessorFilter`
      - Composable filter on top of `Processor`s that can transform the
        input data type
    - Move all deserialization and extraction of data from
      `CollectorService` and `WriteQueueWorker` to Scribe related
      `ProcessFilter` and `Processor`.
    - `WriteQueueWorker` now takes only one `Processor` rather than a
      sequence of them.
    - Add `FanoutProcessor` to blast work to multiple `Processor`s
    - Update README with module diagram

    Author: @franklinhu
    Pull Request: #31
    URL: #31

commit 0a3d75e
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Jun 14 14:07:58 2012 -0700

    Move the ServerResponsetimeSpec into the correct directory

    Author: @johanoskarsson
    Pull Request: #29
    URL: #29

commit 741c3c9
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Thu Jun 14 13:34:11 2012 -0700

    Two simple tests for the ServerResponsetime Hadoop jobs

    Author: @johanoskarsson
    Pull Request: #28
    URL: #28

commit 73105fd
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 14 10:08:54 2012 -0700

    Move Scribe collector/config to zipkin-scribe

    Move the Scribe specific code to a new module: `zipkin-scribe` including:
    - ScribeCollectorService
    - ScribeCollectorService related configs
    - collector-dev config
    - Main class
    - related tests

    The collector can no longer be run from `zipkin-server`.

    Author: @franklinhu
    Pull Request: #27
    URL: #27

commit a168cba
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 14 08:38:58 2012 -0700

    Make Github commit author linkable

    Author: @franklinhu
    Pull Request: #26
    URL: #26

commit 8dad6f2
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jun 13 13:34:58 2012 -0700

    zipkin-scrooge

    Pull scrooge/thrift dependency out of `zipkin-common` and `zipkin-server` into `zipkin-scrooge`. This will allow us to do further refactoring easily.
    - Add `AnnotationType` and `BinaryAnnotation` classes for direct mirroring of thrift structs
    - Unify `toThrift` and `fromThrift` methods in `ThriftAdapter` that handles the different structs defined in the thrift file. We can in the future make this configurable in the collector service.
    - Use one set of `Constants` rather than the thrift generated ones
    - Fix tests
      - Move thrift related tests to `ThriftAdapterSpec`

    Author: @franklinhu
    Pull Request: #24
    URL: #24

commit 46574a9
Merge: a4fbcf7 02fbd24
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jun 13 13:24:26 2012 -0700

    Merge branch 'master' of github.com:twitter/zipkin

commit 02fbd24
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jun 13 12:46:51 2012 -0700

    Reduce the garbage generated in the collector. Before we got about 400kb of garbage per sampled request, after it's at about 300kb.

    Includes these changes
    * don't recalculate the lowercase version of service names in span each time they are used
    * don't create the incoming data log message unless debug is turned on
    * reuse some data instead of recalculating when indexing in Cassandra

    Author: johanoskarsson
    Pull Request: #25
    URL: #25

commit a4fbcf7
Author: Franklin Hu <franklin@twitter.com>
Date:   Wed Jun 13 10:32:00 2012 -0700

    Tear down ZK server after test is finished

    Author: franklinhu
    Pull Request: #23
    URL: #23

commit 8edcc1b
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 12 16:05:04 2012 -0700

    zipkin-query gem thrift fix

    - Needed `Endpoint` thrift structs, so moved through over from `zipkin-web/lib`
    - Bumped version `0.0.1` -> `0.0.2`

    Author: franklinhu
    Pull Request: #21
    URL: #21

commit b7534c3
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 12 15:38:16 2012 -0700

    Split common classes into zipkin-common

    - Moved:
      - `Annotation` (and spec)
      - `Endpoint` (and spec)
      - `IncompleteTraceDataException`
      - `Span` (and spec)
    - Left `Trace`, `TraceSummary` in `zipkin-server` since they're
      specific to the query service
    - Left `ZooKeeperClientService` since don't want to introduce a ZK
      dependency in common project
    - `IncompleteTraceDataException` can be later removed when we pull
      out the Thrift dependencies

    Author: franklinhu
    Pull Request: #20
    URL: #20

commit f05094c
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 12 13:45:10 2012 -0700

    zipkin-query gem

    Split access to Zipkin Query service out into separate gem
    - Fix generated ruby namespacing in `zipkin-thrift`
    - Thrift files are symlinked in `zipkin-gems/zipkin-query/thrift`, and
      the generated code is in `zipkin-gems/zipkin-query/vendor`

    Author: franklinhu
    Pull Request: #19
    URL: #19

commit 66bb8e5
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Tue Jun 12 11:45:20 2012 -0700

    Fix the hadoop command, tools class no longer needed. Update readme

    Author: johanoskarsson
    Pull Request: #18
    URL: #18

commit b4f2198
Author: Franklin Hu <franklin@twitter.com>
Date:   Tue Jun 12 10:06:07 2012 -0700

    zipkin-tracer gem

    Add tracing to a Rack application

    - In config.ru: `use ZipkinTracer::RackHandler`
    - Configurable in Rails configs

    Author: franklinhu
    Pull Request: #13
    URL: #13

commit de8b7fc
Author: Franklin Hu <franklin@twitter.com>
Date:   Mon Jun 11 13:17:58 2012 -0700

    zipkin-web: sort order fix

    - Sort query results correctly when doing additional searches
    - Fix typo

    Author: franklinhu
    Pull Request: #16
    URL: #16

commit 08e3910
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Mon Jun 11 10:18:03 2012 -0700

    Seems the EB repo has moved. Updated the url

    Author: johanoskarsson
    Pull Request: #14
    URL: #14

commit 3179777
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Fri Jun 8 11:05:12 2012 -0700

    Added a section to the readme describing how to instrument a library

    Author: johanoskarsson
    Pull Request: #10
    URL: #10

commit a7d393d
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 7 13:30:00 2012 -0700

    zipkin-web: query result sorting

    Allow sorting by:
    - timestamp (asc|desc)
    - duration (asc|desc)

    Author: franklinhu
    Pull Request: #9
    URL: #9

commit c21b39b
Author: Franklin Hu <franklin@twitter.com>
Date:   Thu Jun 7 11:49:35 2012 -0700

    s/ui/UI/

    Author: franklinhu
    Pull Request: #6
    URL: #6

commit 79d28ed
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jun 6 16:38:20 2012 -0700

    Change version to 0.2.0-SNAPSHOT

commit 25aae4a
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jun 6 16:30:21 2012 -0700

    Make the required changes to let us create releases

commit e9ee209
Author: Johan Oskarsson <johan@oskarsson.nu>
Date:   Wed Jun 6 13:51:59 2012 -0700

    Linkify the Twitter accounts in the README.
d2a01b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 6, 2012
  1. Move Trace to zipkin-common (part 1)

    Franklin Hu authored
    Moved TraceTimeline and TimelineAnnotation to zipkin-common, pulled out
    some thrift dependencies
  2. Add license headers

    Franklin Hu authored
  3. Add some doc

    Franklin Hu authored
This page is out of date. Refresh to see the latest.
View
29 zipkin-common/src/main/scala/com/twitter/zipkin/adapter/QueryAdapter.scala
@@ -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
+}
View
25 zipkin-common/src/main/scala/com/twitter/zipkin/query/TimelineAnnotation.scala
@@ -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)
View
29 zipkin-common/src/main/scala/com/twitter/zipkin/query/TraceTimeline.scala
@@ -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])
View
66 zipkin-scrooge/src/main/scala/com/twitter/zipkin/adapter/ThriftQueryAdapter.scala
@@ -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(_) })
+ }
+}
View
19 zipkin-server/src/main/scala/com/twitter/zipkin/common/Trace.scala
@@ -19,11 +19,12 @@ package com.twitter.zipkin.common
import com.twitter.zipkin.gen
import collection.mutable
import mutable.HashMap
-import com.twitter.zipkin.query.conversions.TraceToTimeline
import com.twitter.logging.Logger
import java.nio.ByteBuffer
-import com.twitter.zipkin.adapter.ThriftAdapter
import com.twitter.finagle.tracing.{Trace => FTrace}
+import com.twitter.zipkin.query.conversions.TraceToTimeline
+import com.twitter.zipkin.adapter.{ThriftQueryAdapter, ThriftAdapter}
+import com.twitter.zipkin.query.TraceTimeline
/**
* Represents a trace, a bundle of spans.
@@ -49,8 +50,6 @@ case class Trace(spans: Seq[Span]) {
val log = Logger.get(getClass.getName)
- private[this] val traceToTimeline = new TraceToTimeline
-
/**
* Find the trace id for this trace.
* Returns none if we have no spans to look up id by
@@ -150,13 +149,13 @@ case class Trace(spans: Seq[Span]) {
serviceCounts, endpoints.toList)
}
- def toTimeline: Option[gen.TraceTimeline] = {
+ def toTimeline: Option[TraceTimeline] = {
FTrace.record("toTimeline")
- traceToTimeline.toTraceTimeline(this)
+ TraceToTimeline(this)
}
def toTraceCombo: gen.TraceCombo = {
- gen.TraceCombo(toThrift, toTraceSummary.map(ThriftAdapter(_)), toTimeline, toSpanDepths)
+ gen.TraceCombo(toThrift, toTraceSummary.map(ThriftAdapter(_)), toTimeline.map(ThriftQueryAdapter(_)), toSpanDepths)
}
/**
@@ -187,11 +186,9 @@ case class Trace(spans: Seq[Span]) {
/**
* Get all the binary annotations in this trace.
*/
- def getBinaryAnnotations: Seq[gen.BinaryAnnotation] = {
+ def getBinaryAnnotations: Seq[BinaryAnnotation] = {
spans.map {
- _.binaryAnnotations.map {
- ThriftAdapter(_)
- }
+ _.binaryAnnotations
}.flatten
}
View
4 zipkin-server/src/main/scala/com/twitter/zipkin/query/QueryService.scala
@@ -28,7 +28,7 @@ import com.twitter.zipkin.storage.{Aggregates, TraceIdDuration, Index, Storage}
import java.nio.ByteBuffer
import org.apache.thrift.TException
import scala.collection.Set
-import com.twitter.zipkin.adapter.ThriftAdapter
+import com.twitter.zipkin.adapter.{ThriftQueryAdapter, ThriftAdapter}
/**
* Able to respond to users queries regarding the traces. Usually does so
@@ -202,7 +202,7 @@ class QueryService(storage: Storage, index: Index, aggregates: Aggregates, adjus
Stats.timeFutureMillis("query.getTraceTimelinesByIds") {
storage.getTracesByIds(traceIds).map { id =>
- id.flatMap(adjusters.foldLeft(_)((trace, adjuster) => adjuster.adjust(trace)).toTimeline)
+ id.flatMap(adjusters.foldLeft(_)((trace, adjuster) => adjuster.adjust(trace)).toTimeline.map(ThriftQueryAdapter(_)))
} rescue {
case e: Exception =>
log.error(e, "getTraceTimelinesByIds query failed")
View
23 zipkin-server/src/main/scala/com/twitter/zipkin/query/conversions/TraceToTimeline.scala
@@ -15,13 +15,12 @@
*/
package com.twitter.zipkin.query.conversions
-import com.twitter.zipkin.gen
-import com.twitter.zipkin.common.{IncompleteTraceDataException, Endpoint, Trace}
-import com.twitter.zipkin.adapter.ThriftAdapter
+import com.twitter.zipkin.common._
+import com.twitter.zipkin.query.{TraceTimeline, TimelineAnnotation}
-class TraceToTimeline {
+object TraceToTimeline {
- def toTraceTimeline(trace: Trace): Option[gen.TraceTimeline] = {
+ def apply(trace: Trace): Option[TraceTimeline] = {
if (trace.spans.isEmpty) {
return None
@@ -30,16 +29,18 @@ class TraceToTimeline {
// convert span and annotation to timeline annotation
val annotations = trace.spans.flatMap(s =>
s.annotations.map{ a =>
- gen.TimelineAnnotation(a.timestamp, a.value,
+ TimelineAnnotation(
+ a.timestamp,
+ a.value,
a.host match {
- case Some(s) => ThriftAdapter(s)
- case None => ThriftAdapter(Endpoint.Unknown)
+ case Some(s) => s
+ case None => Endpoint.Unknown
},
s.id,
s.parentId,
a.host match {
case Some(s) => s.serviceName
- case None => "Unknown"
+ case None => "Unknown"
},
s.name)
}
@@ -53,7 +54,7 @@ class TraceToTimeline {
val rootSpanId = trace.getRootMostSpan.getOrElse(return None).id
val id = trace.id.getOrElse(return None)
- Some(gen.TraceTimeline(id, rootSpanId, annotations, trace.getBinaryAnnotations))
+ Some(TraceTimeline(id, rootSpanId, annotations, trace.getBinaryAnnotations))
}
-}
+}
View
8 zipkin-server/src/test/scala/com/twitter/zipkin/common/TraceSpec.scala
@@ -119,10 +119,10 @@ class TraceSpec extends Specification {
}
"getBinaryAnnotations" in {
- val ba1 = gen.BinaryAnnotation("key1", ByteBuffer.wrap("value1".getBytes), gen.AnnotationType.String)
- val span1 = Span(1L, "", 1L, None, List(), List(ThriftAdapter(ba1)))
- val ba2 = gen.BinaryAnnotation("key2", ByteBuffer.wrap("value2".getBytes), gen.AnnotationType.String)
- val span2 = Span(1L, "", 2L, None, List(), List(ThriftAdapter(ba2)))
+ val ba1 = BinaryAnnotation("key1", ByteBuffer.wrap("value1".getBytes), ThriftAdapter(gen.AnnotationType.String), None)
+ val span1 = Span(1L, "", 1L, None, List(), List(ba1))
+ val ba2 = BinaryAnnotation("key2", ByteBuffer.wrap("value2".getBytes), ThriftAdapter(gen.AnnotationType.String), None)
+ val span2 = Span(1L, "", 2L, None, List(), List(ba2))
val trace = Trace(List[Span](span1, span2))
Seq(ba1, ba2) mustEqual trace.getBinaryAnnotations
View
4 zipkin-server/src/test/scala/com/twitter/zipkin/query/QueryServiceSpec.scala
@@ -25,8 +25,8 @@ import com.twitter.zipkin.common._
import java.nio.ByteBuffer
import com.twitter.util.Future
import com.twitter.scrooge.BinaryThriftStructSerializer
-import com.twitter.zipkin.adapter.ThriftAdapter
import com.twitter.zipkin.storage.{Aggregates, TraceIdDuration, Storage, Index}
+import com.twitter.zipkin.adapter.{ThriftQueryAdapter, ThriftAdapter}
class QueryServiceSpec extends Specification with JMocker with ClassMocker {
val ep1 = Endpoint(123, 123, "service1")
@@ -181,7 +181,7 @@ class QueryServiceSpec extends Specification with JMocker with ClassMocker {
}
val trace = trace1.toThrift
val summary = ThriftAdapter(TraceSummary(1, 100, 150, 50, Map("service1" -> 1), List(ep1)))
- val timeline = trace1.toTimeline
+ val timeline = trace1.toTimeline.map(ThriftQueryAdapter(_))
val combo = gen.TraceCombo(trace, Some(summary), timeline, Some(Map(666L -> 1)))
Seq(combo) mustEqual qs.getTraceCombosByIds(List(traceId), List())()
}
View
33 zipkin-server/src/test/scala/com/twitter/zipkin/query/conversions/TraceToTimelineSpec.scala
@@ -18,11 +18,12 @@ package com.twitter.zipkin.query.conversions
import org.specs.Specification
import org.specs.mock.{ClassMocker, JMocker}
import com.twitter.zipkin.gen
-import com.twitter.zipkin.common.{Trace, Span, Annotation, Endpoint}
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 TraceToTimelineSpec extends Specification with JMocker with ClassMocker {
@@ -60,9 +61,9 @@ class TraceToTimelineSpec extends Specification with JMocker with ClassMocker {
val endpoint2 = Some(Endpoint(2, 2, cassieName)) //54147
val endpoint3 = Some(Endpoint(3, 3, koalabirdName)) //36516
- val et1 = ThriftAdapter(endpoint1.get)
- val et2 = ThriftAdapter(endpoint2.get)
- val et3 = ThriftAdapter(endpoint3.get)
+ val et1 = endpoint1.get
+ val et2 = endpoint2.get
+ val et3 = endpoint3.get
// This is from a real trace, at least what the data would look like
// after being run through the TimeSkewAdjuster
@@ -73,10 +74,10 @@ class TraceToTimelineSpec extends Specification with JMocker with ClassMocker {
val ann5 = Annotation(85, gen.Constants.CLIENT_RECV, endpoint2)
val ann6 = Annotation(87, gen.Constants.CLIENT_RECV, endpoint3)
- val ba1 = gen.BinaryAnnotation("key1", ByteBuffer.wrap("value1".getBytes), gen.AnnotationType.String)
+ val ba1 = BinaryAnnotation("key1", ByteBuffer.wrap("value1".getBytes), ThriftAdapter(gen.AnnotationType.String), None)
val span1 = Span(1, "ValuesFromSource", 2209720933601260005L, None,
- List(ann3, ann6), List(ThriftAdapter(ba1)))
+ List(ann3, ann6), List(ba1))
val span2 = Span(1, "ValuesFromSource", 2209720933601260005L, None,
List(ann4, ann1), Nil)
// the above two spans are part of the same actual span
@@ -86,32 +87,30 @@ class TraceToTimelineSpec extends Specification with JMocker with ClassMocker {
val trace = new Trace(List(span1, span2, span3))
// annotation numbers match those above, order in list should not though
- val tAnn1 = gen.TimelineAnnotation(1, gen.Constants.SERVER_RECV, et1,
+ val tAnn1 = TimelineAnnotation(1, gen.Constants.SERVER_RECV, et1,
2209720933601260005L, None, cuckooName, "ValuesFromSource")
- val tAnn2 = gen.TimelineAnnotation(1, gen.Constants.CLIENT_SEND, et2,
+ val tAnn2 = TimelineAnnotation(1, gen.Constants.CLIENT_SEND, et2,
-855543208864892776L, Some(2209720933601260005L), cassieName, "multiget_slice")
- val tAnn3 = gen.TimelineAnnotation(1, gen.Constants.CLIENT_SEND, et3,
+ val tAnn3 = TimelineAnnotation(1, gen.Constants.CLIENT_SEND, et3,
2209720933601260005L, None, koalabirdName, "ValuesFromSource")
- val tAnn4 = gen.TimelineAnnotation(86, gen.Constants.SERVER_SEND, et1,
+ val tAnn4 = TimelineAnnotation(86, gen.Constants.SERVER_SEND, et1,
2209720933601260005L, None, cuckooName, "ValuesFromSource")
- val tAnn5 = gen.TimelineAnnotation(85, gen.Constants.CLIENT_RECV, et2,
+ val tAnn5 = TimelineAnnotation(85, gen.Constants.CLIENT_RECV, et2,
-855543208864892776L, Some(2209720933601260005L), cassieName, "multiget_slice")
- val tAnn6 = gen.TimelineAnnotation(87, gen.Constants.CLIENT_RECV, et3,
+ val tAnn6 = TimelineAnnotation(87, gen.Constants.CLIENT_RECV, et3,
2209720933601260005L, None, koalabirdName, "ValuesFromSource")
- val expectedTimeline = gen.TraceTimeline(1, 2209720933601260005L, List(tAnn3, tAnn1, tAnn2,
+ val expectedTimeline = TraceTimeline(1, 2209720933601260005L, List(tAnn3, tAnn1, tAnn2,
tAnn5, tAnn4, tAnn6), List(ba1))
- val traceToTimeline = new TraceToTimeline
-
"TraceToTimelineSpec" should {
"convert to timeline with correct annotations ordering" in {
- val actualTimeline = traceToTimeline.toTraceTimeline(trace)
+ val actualTimeline = TraceToTimeline(trace)
Some(expectedTimeline) mustEqual actualTimeline
}
"return none if empty trace" in {
- val actualTimeline = traceToTimeline.toTraceTimeline(new Trace(List()))
+ val actualTimeline = TraceToTimeline(new Trace(List()))
None mustEqual actualTimeline
}
}
Something went wrong with that request. Please try again.