diff --git a/project/Project.scala b/project/Project.scala index 233384b0c0f..503f3ab545e 100644 --- a/project/Project.scala +++ b/project/Project.scala @@ -263,7 +263,7 @@ object Zipkin extends Build { resolvers += "codahale" at "http://repo.codahale.com", libraryDependencies ++= Seq( - "com.twitter" % "finatra" % "0.2.1", + "com.twitter" % "finatra" % "0.2.3", "com.twitter.common.zookeeper" % "server-set" % "1.0.7", diff --git a/zipkin-finatra/src/main/resources/public/css/application.css b/zipkin-finatra/src/main/resources/public/css/application.css index 6af19d83d23..46f49538d4c 100644 --- a/zipkin-finatra/src/main/resources/public/css/application.css +++ b/zipkin-finatra/src/main/resources/public/css/application.css @@ -426,11 +426,11 @@ ul.traces li .trace-details { } ul.traces li .services { - width: 79.7%; + width: 80%; } ul.traces li .timestamp { - width: 20%; + width: 19%; text-align: right; } diff --git a/zipkin-finatra/src/main/resources/public/js/application-index.js b/zipkin-finatra/src/main/resources/public/js/application-index.js index ed68fe64d01..eddf9d9182e 100644 --- a/zipkin-finatra/src/main/resources/public/js/application-index.js +++ b/zipkin-finatra/src/main/resources/public/js/application-index.js @@ -227,9 +227,9 @@ Zipkin.Application.Index = (function() { data.sort(function(a, b) { if (sortOrder == ORDER_TIMESTAMP_ASC) { - return new Date(a.start_time) - new Date(b.start_time); + return new Date(a.startTimestamp) - new Date(b.startTimestamp); } else if (sortOrder == ORDER_TIMESTAMP_DESC) { - return new Date(b.start_time) - new Date(a.start_time); + return new Date(b.startTimestamp) - new Date(a.startTimestamp); } else if (sortOrder == ORDER_DURATION_ASC) { return a.duration - b.duration; } else { @@ -419,6 +419,7 @@ Zipkin.Application.Index = (function() { return { name: key, count: count }; }); e.url = root_url + "show/" + e.traceId; + e.startTime = Zipkin.Util.timeAgoInWords(e.startTimestamp / 1000); return e; }); traces = updateFilteredServices(traces); diff --git a/zipkin-finatra/src/main/resources/public/templates/query.mustache b/zipkin-finatra/src/main/resources/public/templates/query.mustache index 1530d580d3e..9847f52c09a 100644 --- a/zipkin-finatra/src/main/resources/public/templates/query.mustache +++ b/zipkin-finatra/src/main/resources/public/templates/query.mustache @@ -12,7 +12,7 @@ {{/serviceCounts}} -
+
{{startTime}}
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 bbf9e7e9a05..ad2cfb41257 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 @@ -100,7 +100,7 @@ class App(config: ZipkinWebConfig, client: gen.ZipkinQuery.FinagledClient) exten } } } - }.map(render.json(_)) + }.flatten.map(render.json(_)) } /** diff --git a/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/ZipkinWeb.scala b/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/ZipkinWeb.scala index 1af84f56e17..bc45a397fa8 100644 --- a/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/ZipkinWeb.scala +++ b/zipkin-finatra/src/main/scala/com/twitter/zipkin/web/ZipkinWeb.scala @@ -5,19 +5,28 @@ import com.twitter.finagle.http.Http import com.twitter.finagle.builder.{ClientBuilder, ServerBuilder, Server} import com.twitter.finagle.thrift.ThriftClientFramedCodec import com.twitter.finagle.zookeeper.ZookeeperServerSetCluster -import com.twitter.finatra.{AppService, Controller, FinatraServer} -import com.twitter.ostrich.admin.{ServiceTracker, Service} +import com.twitter.finatra_core.{AbstractFinatraController, ControllerCollection} +import com.twitter.finatra._ +import com.twitter.ostrich.admin.ServiceTracker +import com.twitter.ostrich.admin import com.twitter.logging.Logger import com.twitter.io.{Files, TempFile} import com.twitter.zipkin.config.ZipkinWebConfig import com.twitter.zipkin.gen +import com.twitter.util.Future import java.net.InetSocketAddress +import org.jboss.netty.handler.codec.http.HttpResponse +import scala.Left +import scala.Right +import scala.Some -class ZipkinWeb(config: ZipkinWebConfig) extends Service { +class ZipkinWeb(config: ZipkinWebConfig) extends admin.Service { val log = Logger.get() var server: Option[Server] = None + val controllers = new ControllerCollection[Request, Future[Response], Future[HttpResponse]] + def start() { val clientBuilder = ClientBuilder() .codec(ThriftClientFramedCodec()) @@ -43,10 +52,10 @@ class ZipkinWeb(config: ZipkinWebConfig) extends Service { val resource = config.resource val app = config.appConfig(client) - FinatraServer.register(resource) - FinatraServer.register(app) + register(resource) + register(app) - val finatraService = new AppService + val finatraService = new AppService(controllers) val service = finatraService server = Some { @@ -63,6 +72,10 @@ class ZipkinWeb(config: ZipkinWebConfig) extends Service { def shutdown() { server.foreach { _.close() } } + + def register(app: AbstractFinatraController[Request, Future[Response], Future[HttpResponse]]) { + controllers.add(app) + } } class Resource(resourceDirs: Map[String, String]) extends Controller {