Code Monkey home page Code Monkey logo

twitter-server's Introduction

TwitterServer

Build Status Project status Gitter Maven Central

TwitterServer defines a template from which servers at Twitter are built. It provides common application components such as an administrative HTTP server, tracing, stats, etc. These features are wired in correctly for use in production at Twitter.

Status

This project is used in production at Twitter (and many other organizations), and is being actively developed and maintained.

Documentation

Browse the user guide.

Releases

Releases are done on an approximately monthly schedule. While semver is not followed, the changelogs are detailed and include sections on public API breaks and changes in runtime behavior.

Getting involved

Contributing

We feel that a welcoming community is important and we ask that you follow Twitter's Open Source Code of Conduct in all interactions with the community.

The release branch of this repository contains the latest stable release of TwitterServer, and weekly snapshots are published to the develop branch. In general pull requests should be submitted against develop. See CONTRIBUTING.md for more details about how to contribute.

License

Copyright 2013 Twitter, Inc.

Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0

twitter-server's People

Contributors

baroquebobcat avatar cacoco avatar ctutika avatar dinocassowary avatar dotordogh avatar edma2 avatar enbnt avatar felixbr avatar grimreaper avatar hamdiallam avatar heligw avatar illicitonion avatar isabelmartin avatar jcrossley avatar joybestourous avatar jyanjing avatar kevinoliver avatar luciferous avatar mariusae avatar mattdickinson5 avatar mosesn avatar nepthar avatar ryanoneill avatar sprsquish avatar stevegury avatar tigerlily-he avatar travisbrown avatar vkostyukov avatar wisechengyi avatar yufangong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter-server's Issues

Tutorial code fails with "object Charsets is not a member of package com.twitter.io"

When creating a new project by following the tutorial instructions at http://twitter.github.io/twitter-server/ sbt compile fails with the error below. Here is a bash script that reproduces the error from scratch.

Charsets is part of com.twitter.io in util-core. I can't tell if this is just a documentation issue and I'm missing something or if the dependencies are incorrect.

Scala compiler version 2.10.4 -- Copyright 2002-2013, LAMP/EPFL
sbt launcher version 0.13.1
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
[info] Set current project to twitter-server_repro (in build file:/Users/ryan/Development/twitter-server_repro/)
[info] Compiling 1 Scala source to /Users/ryan/Development/twitter-server_repro/target/scala-2.10/classes...
[error] /Users/ryan/Development/twitter-server_repro/src/main/scala/com/example/BasicServer.scala:2: object Charsets is not a member of package com.twitter.io
[error] import com.twitter.io.Charsets
[error]        ^
[error] /Users/ryan/Development/twitter-server_repro/src/main/scala/com/example/BasicServer.scala:13: not found: value Charsets
[error]       response.setContent(copiedBuffer("hello", Charsets.Utf8))
[error]                                                 ^
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 2 s, completed Sep 27, 2014 10:22:22 AM

Changing Charsets.Utf8 to call Charset.forName("UTF-8") from java.nio.charset directly works as expected.

NoClassDefFoundError: Could not initialize class com.twitter.server.util.JsonConverter

When I access the TwitterServer's admin interface (e.g. at http://localhost:9990/admin/metrics) I get a NoClassDefFoundError

Expected behavior

Expected the stats to appear

Actual behavior

Console repeatedly generates java.lang.NoClassDefFoundError: Could not initialize class com.twitter.server.util.JsonConverter plus a stack trace:

W 0824 15:11:06.000 THREAD74: Unhandled exception in connection with /127.0.0.1:54989 , shutting down connection
java.lang.NoClassDefFoundError: Could not initialize class com.twitter.server.util.JsonConverter$
    at com.twitter.server.handler.MetricQueryHandler.apply(MetricQueryHandler.scala:54)
    at com.twitter.server.handler.MetricQueryHandler.apply(MetricQueryHandler.scala:34)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.server.view.IndexView.apply(IndexView.scala:123)
    at com.twitter.server.view.IndexView.apply(IndexView.scala:114)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.http.HttpMuxer.apply(HttpMuxer.scala:62)
    at com.twitter.finagle.http.HttpMuxer.apply(HttpMuxer.scala:25)
    at com.twitter.server.util.HttpUtils$$anonfun$combine$1.com$twitter$server$util$HttpUtils$$anonfun$$loop$1(HttpUtils.scala:25)
    at com.twitter.server.util.HttpUtils$$anonfun$combine$1.apply(HttpUtils.scala:35)
    at com.twitter.server.util.HttpUtils$$anonfun$combine$1.apply(HttpUtils.scala:20)
    at com.twitter.finagle.Service$$anon$5.apply(Service.scala:28)
    at com.twitter.server.AdminHttpServer$$anon$1.apply(AdminHttpServer.scala:74)
    at com.twitter.server.AdminHttpServer$$anon$1.apply(AdminHttpServer.scala:73)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.server.view.NotFoundView.apply(NotFoundView.scala:41)
    at com.twitter.server.view.NotFoundView.apply(NotFoundView.scala:37)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.ServiceProxy.apply(Service.scala:120)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.tracing.ServerDestTracingProxy$$anon$1.apply(DestinationTracing.scala:32)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.service.DeadlineStatsFilter.apply(DeadlineStatsFilter.scala:59)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.filter.ExceptionSourceFilter.apply(ExceptionSourceFilter.scala:42)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.http.filter.HttpNackFilter.apply(HttpNackFilter.scala:55)
    at com.twitter.finagle.http.filter.HttpNackFilter.apply(HttpNackFilter.scala:48)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:13)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8$$anonfun$apply$2$$anonfun$apply$3.apply(Codec.scala:476)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8$$anonfun$apply$2$$anonfun$apply$3.apply(Codec.scala:476)
    at com.twitter.finagle.http.TraceInfo$$anonfun$letTraceIdFromRequestHeaders$2.apply(Codec.scala:422)
    at com.twitter.util.Local.let(Local.scala:141)
    at com.twitter.finagle.context.Context$class.let(Context.scala:176)
    at com.twitter.finagle.context.MarshalledContext.let(Context.scala:232)
    at com.twitter.finagle.tracing.Trace$.letId(Trace.scala:167)
    at com.twitter.finagle.http.TraceInfo$.letTraceIdFromRequestHeaders(Codec.scala:420)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8$$anonfun$apply$2.apply(Codec.scala:476)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8$$anonfun$apply$2.apply(Codec.scala:476)
    at com.twitter.util.Local.let(Local.scala:141)
    at com.twitter.finagle.context.Context$class.let(Context.scala:176)
    at com.twitter.finagle.context.LocalContext.let(LocalContext.scala:8)
    at com.twitter.finagle.tracing.Trace$.letTracer(Trace.scala:185)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8.apply(Codec.scala:475)
    at com.twitter.finagle.http.HttpServerTraceInitializer$$anonfun$8.apply(Codec.scala:474)
    at com.twitter.finagle.Filter$$anon$6.apply(Filter.scala:254)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.filter.MonitorFilter.apply(MonitorFilter.scala:39)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.filter.PayloadSizeFilter.apply(PayloadSizeFilter.scala:29)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.http.filter.ServerContextFilter$$anonfun$apply$1.apply(ContextFilter.scala:16)
    at com.twitter.finagle.http.filter.ServerContextFilter$$anonfun$apply$1.apply(ContextFilter.scala:16)
    at com.twitter.finagle.http.codec.HttpContext$.read(HttpContext.scala:52)
    at com.twitter.finagle.http.filter.ServerContextFilter.apply(ContextFilter.scala:16)
    at com.twitter.finagle.http.filter.ServerContextFilter.apply(ContextFilter.scala:12)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.Service$$anon$1.apply(Service.scala:16)
    at com.twitter.finagle.http.filter.DtabFilter.apply(DtabFilter.scala:26)
    at com.twitter.finagle.http.filter.DtabFilter.apply(DtabFilter.scala:12)
    at com.twitter.finagle.Filter$$anon$1.apply(Filter.scala:79)
    at com.twitter.finagle.http.codec.HttpServerDispatcher.dispatch(HttpServerDispatcher.scala:61)
    at com.twitter.finagle.http.codec.HttpServerDispatcher.dispatch(HttpServerDispatcher.scala:20)
    at com.twitter.finagle.http.exp.GenSerialServerDispatcher$$anonfun$com$twitter$finagle$http$exp$GenSerialServerDispatcher$$loop$1$$anonfun$apply$1.apply$mcV$sp(ServerDispatcher.scala:55)
    at com.twitter.finagle.http.exp.GenSerialServerDispatcher$$anonfun$com$twitter$finagle$http$exp$GenSerialServerDispatcher$$loop$1$$anonfun$apply$1.apply(ServerDispatcher.scala:54)
    at com.twitter.finagle.http.exp.GenSerialServerDispatcher$$anonfun$com$twitter$finagle$http$exp$GenSerialServerDispatcher$$loop$1$$anonfun$apply$1.apply(ServerDispatcher.scala:54)
    at com.twitter.util.Local.let(Local.scala:141)
    at com.twitter.finagle.context.Context$class.let(Context.scala:176)
    at com.twitter.finagle.context.LocalContext.let(LocalContext.scala:8)
    at com.twitter.finagle.http.exp.GenSerialServerDispatcher$$anonfun$com$twitter$finagle$http$exp$GenSerialServerDispatcher$$loop$1.apply(ServerDispatcher.scala:53)
    at com.twitter.finagle.http.exp.GenSerialServerDispatcher$$anonfun$com$twitter$finagle$http$exp$GenSerialServerDispatcher$$loop$1.apply(ServerDispatcher.scala:48)
    at com.twitter.util.Future$$anonfun$flatMap$1.apply(Future.scala:1092)
    at com.twitter.util.Future$$anonfun$flatMap$1.apply(Future.scala:1091)
    at com.twitter.util.Promise$Transformer.liftedTree1$1(Promise.scala:107)
    at com.twitter.util.Promise$Transformer.k(Promise.scala:107)
    at com.twitter.util.Promise$Transformer.apply(Promise.scala:117)
    at com.twitter.util.Promise$Transformer.apply(Promise.scala:98)
    at com.twitter.util.Promise$$anon$1.run(Promise.scala:436)
    at com.twitter.concurrent.LocalScheduler$Activation.run(Scheduler.scala:201)
    at com.twitter.concurrent.LocalScheduler$Activation.submit(Scheduler.scala:159)
    at com.twitter.concurrent.LocalScheduler.submit(Scheduler.scala:239)
    at com.twitter.concurrent.Scheduler$.submit(Scheduler.scala:107)
    at com.twitter.util.Promise.runq(Promise.scala:405)
    at com.twitter.util.Promise.updateIfEmpty(Promise.scala:796)
    at com.twitter.util.Promise.update(Promise.scala:770)
    at com.twitter.util.Promise.setValue(Promise.scala:746)
    at com.twitter.concurrent.AsyncQueue.offer(AsyncQueue.scala:120)
    at com.twitter.finagle.netty3.transport.ChannelTransport.handleUpstream(ChannelTransport.scala:55)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.SimpleChannelHandler.messageReceived(SimpleChannelHandler.java:142)
    at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:145)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at com.twitter.finagle.http.SafeServerHttpChunkAggregator.handleUpstream(Codec.scala:101)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.messageReceived(SimpleChannelUpstreamHandler.java:124)
    at com.twitter.finagle.http.codec.RespondToExpectContinue.messageReceived(RespondToExpectContinue.scala:30)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.messageReceived(SimpleChannelUpstreamHandler.java:124)
    at com.twitter.finagle.http.codec.PayloadSizeHandler.messageReceived(PayloadSizeHandler.scala:22)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.codec.http.HttpContentDecoder.messageReceived(HttpContentDecoder.java:108)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.codec.http.HttpContentEncoder.messageReceived(HttpContentEncoder.java:82)
    at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.handler.codec.http.HttpServerCodec.handleUpstream(HttpServerCodec.java:56)
    at com.twitter.finagle.http.SafeHttpServerCodec.handleUpstream(Codec.scala:123)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at com.twitter.finagle.util.ProxyThreadFactory$$anonfun$newProxiedRunnable$1$$anon$1.run(ProxyThreadFactory.scala:19)
    at java.lang.Thread.run(Thread.java:745)

Steps to reproduce the behavior

Start the server and navigate to e.g. http://localhost:9990/admin/metrics

    val server = Http.server
      .withAdmissionControl.concurrencyLimit(
      maxConcurrentRequests = 10,
      maxWaiters = 10
    ).serve(":8081", api.toService)

    onExit {
      server.close()
    }

    Await.ready(adminHttpServer)

I'm using twitter-server 1.21.0 and finagle 6.36.0 (via finch 0.11.0-M2).

AdminHttpServer.routes are not registered to admin server

Before following commit, we can add admin route by overriding def routes. currently overriding def routes has no meanings, it's breaking changes. Now we should use addAdminRoute, so propose that removing def routes.

206df64#commitcomment-36904390

Expected behavior

AdminHttpServer.routes registered to admin server.
(But currently we should use addAdminRoute, so it's better to remove AdminHttpServer.routes)

Actual behavior

If override AdminHttpServer.routes, the routes are not registered to admin server

Steps to reproduce the behavior

class SomeServer extends TwitterServer with AdminHttpServer {
  override def routes() = ... // this is not registered to admin server
}

Building on Windows

First; thank you for publishing new open source software! This looks very good to me. Here's a guide for how you can build twitter-server on Windows. Do whatever you want to with the guide - put it in the docs, keep it here as an issue, put it in the wiki, whatever.

Building on Windows

Twitter-server has no "official support" for building on non-Unix-like systems, but it's possible to build it on Windows as well.

Twitter-server is build with sbt. Install sbt for windows: download here. Twitter-server is meant to be built with version 0.12.2 (for now) but might work with other sbt versions as well.

Clone the project:

git clone https://github.com/twitter/twitter-server.git
cd twitter-server

Twitter-server comes with an sbt bootstrapper script, "sbt", found in the root directory. This script won't work on Windows, so you must remove it. Ignore it from git, so you can delete it without commiting the change!

git update-index --assume-unchanged sbt
rm sbt

Now, you're ready to build it:

sbt publish-local

If you want to build for both 2.9.2 and 2.10:

sbt +publish-local

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/util/Converter

Upon booting twitter-server, I get:

java.util.ServiceConfigurationError: com.twitter.finagle.http.HttpMuxHandler: Provider com.twitter.finagle.stats.MetricsExporter could not be instantiated: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/util/Converter
  at java.util.ServiceLoader.fail(ServiceLoader.java:207)
  at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
  at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:360)
  at java.util.ServiceLoader$1.next(ServiceLoader.java:428)
  at scala.collection.JavaConversions$JIteratorWrapper.next(JavaConversions.scala:575)
  at scala.collection.Iterator$class.foreach(Iterator.scala:772)
  at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573)
  at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
  at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:130)
  at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
  ...
  Cause: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/util/Converter
  at com.fasterxml.jackson.module.scala.ser.MapSerializerModule$class.$init$(MapSerializerModule.scala:41)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule.<init>(DefaultScalaModule.scala:18)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<init>(DefaultScalaModule.scala:33)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<clinit>(DefaultScalaModule.scala)
  at com.twitter.finagle.stats.JsonExporter.<init>(JsonExporter.scala:16)
  at com.twitter.finagle.stats.MetricsExporter.<init>(MetricsStatsReceiver.scala:68)
  at com.twitter.finagle.stats.MetricsExporter.<init>(MetricsStatsReceiver.scala:72)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
  ...
  Cause: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.util.Converter
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at com.fasterxml.jackson.module.scala.ser.MapSerializerModule$class.$init$(MapSerializerModule.scala:41)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule.<init>(DefaultScalaModule.scala:18)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<init>(DefaultScalaModule.scala:33)
  at com.fasterxml.jackson.module.scala.DefaultScalaModule$.<clinit>(DefaultScalaModule.scala)
  ...

Adding this seemed to have fixed it:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.2.2</version>
</dependency>

Open source Mesos hosting code

Based on the documentation, it appears that twitter-server apps can be hosted in Mesos. It would be nice if this code was open sourced so that others could host their apps in Mesos as well.

StartsWith patterned HttpMuxer handlers look wrong in the navigation

When using a HttpMuxer handler with a trailing slash, it is not shown nicely in the admin interface.

trait SublinkAdmin extends Lifecycle {
  abstract override def startup() {
    super.startup()
    HttpMuxer.addHandler("/admin/sublinks/", new SublinkAdminFilter)
  }
}

class SublinkAdminFilter extends Service[HttpRequest, HttpResponse] {

  override def apply(httpRequest: HttpRequest): Future[HttpResponse] = {
    val request = Request(httpRequest)
    (request.method, Path(request.path)) match {
      case (GET, Root / "admin" / "sublinks") => list
      case (GET, Root / "admin" / "sublinks" / info) => hello(info)
    }
  }

  private def list: Future[HttpResponse] = {
    val response = Response()
    response.contentString = "Listing"
    Future(response)
  }

  private def hello(info: String): Future[HttpResponse] = {
    val response = Response()
    response.contentString = info
    Future(response)
  }
}

Twitter Developer Account Erroneous Email

Describe the bug
Twitter developer email "developer-accounts [email protected]" sends erroneous email to me. Response to it goes without response for weeks.

To Reproduce
Steps to reproduce the behavior:

  1. Sign up for Twitter developer account.
  2. Submit to request elevated access to the V2 API.
  3. Receive erroneous email.
  4. No one monitoring the email replies when you email back, nor can you get a response on Twitter from @twitterdev @twitter @TwitterSupport accounts.

Expected behavior
Sign up to develop Twitter app. Elevate account to enable necessary features for app.
Receive no erroneous emails.
Publish the app and add value to Twitter community.

Screenshots
Screenshots of erroneous email to help explain the problem:
image
image

Additional context
Erroneous email was replied to on August 10th, 12th, 26th, and September 1st (Today) without any response.

Erroneous email states it was sent in response to inaction from previous attempt to contact us. We have no previous email communication from Twitter.

Admin navigation does not look correct on Firefox

This is using Twitter-Server 1.8.0

When accessing /admin/server_info on Firefox, the navigation on the
left-hand side does not cover the whole height. It works better on Chrome,
though. When scrolling down, the remaining parts of the navigation do not have a background color as well.

Time based metrics disappearing on second visit on metrics page

Hello, I didn't know where should I ask this question, I hope it's ok to put it here. I use Finatra Framework, we want to gather some metrics using built in admin server. I saw some documentation about metrics on Twitter Server github pages (http://twitter.github.io/twitter-server/Features.html#metrics).
This is the endpoint I use: http://localhost:9990/admin/metrics.json?pretty=true

Let's say we have created some endpoints in our app, when I visit those, I see that number of requests displayed on metrics admin page increases (route/endpoint/GET/requests: 2), also I see some nice numbers for time based metrics, for example route/endpoint/GET/time.avg. The problem is that after I refresh metrics page, time based metrics are cleared. Number of requests remain the same, but metrics like time.avg, time.count, time.max, response_size.avg have value of 0. It looks like admin page counts only those requests that were not measured after last /metrics page visit. How can I get metrics for last 5 or 10 minutes?

How to send response using stream?

I want to response text using stream,not :
response.setContent(copiedBuffer("hello", Charsets.Utf8))
Future.value(response)

but like:
response.write(...)
response.flush()
response.write(...)
response.flush()

thanks!

lifecycle endpoint

motivation

It is useful to know from outside of a server how a server is doing internally. For example, this could be used by a smart load balancer to remove servers from pools while they are not doing well, and put them back in when they are ok.

/admin/ping is not a lifecycle endpoint

/admin/ping could be used as a simple binary flag, "OK" "Not OK" by only sending pong when "OK". A flexible lifecycle endpoint should allow for more than that. If some monitoring tools have different behavior depending upon how servers are doing (as in wake up someone if a server falls over, temporarily remove from load balancer if a server's queue is backed up) then it is nice to have more granularity than "OK" / "Not OK".

implementation

A lifecycle endpoint could be defined with a few states, with transitions clearly specified between them. When transitioning from one state to another, you can set up something to happen, such as logging that you're moving from one state to another, and also you can quickly catch unexpected behavior, such as moving directly from STARTING to DEAD. There could be a simple method on a server which transitions you to the next state, and enforces that you are using valid state transitions.

work work

I'd be happy to contribute this if there's interest. We have a similar system at Tumblr that we built around ostrich, and it will probably be simple to build it for twitter-server.

Sbt dependencies correct?

Hi!

I wanted to try this quickly out, so I just copied that one dependency line to build.sbt and run sbt update.
$ cat built.sbt
libraryDependencies += "com.twitter" %% "twitter-server" % "1.0.1"

Dependencies seemed to fail:

[warn] module not found: com.twitter.common#metrics;0.0.7
[warn] ==== local: tried
[warn] /Users/me/.ivy2/local/com.twitter.common/metrics/0.0.7/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/twitter/common/metrics/0.0.7/metrics-0.0.7.pom
[info] Resolving org.apache.thrift#libthrift;0.5.0 ...
[warn] module not found: org.apache.thrift#libthrift;0.5.0
[warn] ==== local: tried
[warn] /Users/me/.ivy2/local/org.apache.thrift/libthrift/0.5.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/apache/thrift/libthrift/0.5.0/libthrift-0.5.0.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.twitter.common#metrics;0.0.7: not found
[warn] :: org.apache.thrift#libthrift;0.5.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

LogFormat breaks documented log formatting changes

A Twitter-Server with LogFormat trait doesn't honor defaultFormatter overrides

Expected behavior

override def defaultFormatter = myFormatter should change log format

Actual behavior

the log format remains unchanged

Steps to reproduce the behavior

Add the log formatter from the user guide and notice the unchanging log format. Removing LogFormat trait from the stack (by extending App and all the other traits rather than TwitterServer) fixes this and the override works as expected.

Unresolved dependencies

Here is what I get with the latest checkout:

$ ./sbt test
[info] Loading project definition from /Users/cthaling/twitter-server/project
[info] Set current project to twitter-server (in build file:/Users/cthaling/twitter-server/)
[info] Updating {file:/Users/cthaling/twitter-server/}twitter-server...
[info] Resolving com.twitter#finagle-core_2.11;6.34.0-SNAPSHOT ...
[warn]  module not found: com.twitter#finagle-core_2.11;6.34.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/finagle-core_2.11/6.34.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/finagle-core_2.11/6.34.0-SNAPSHOT/finagle-core_2.11-6.34.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/finagle-core_2.11/6.34.0-SNAPSHOT/finagle-core_2.11-6.34.0-SNAPSHOT.pom
[info] Resolving com.twitter#finagle-http_2.11;6.34.0-SNAPSHOT ...
[warn]  module not found: com.twitter#finagle-http_2.11;6.34.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/finagle-http_2.11/6.34.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/finagle-http_2.11/6.34.0-SNAPSHOT/finagle-http_2.11-6.34.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/finagle-http_2.11/6.34.0-SNAPSHOT/finagle-http_2.11-6.34.0-SNAPSHOT.pom
[info] Resolving com.twitter#finagle-zipkin_2.11;6.34.0-SNAPSHOT ...
[warn]  module not found: com.twitter#finagle-zipkin_2.11;6.34.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/finagle-zipkin_2.11/6.34.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/finagle-zipkin_2.11/6.34.0-SNAPSHOT/finagle-zipkin_2.11-6.34.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/finagle-zipkin_2.11/6.34.0-SNAPSHOT/finagle-zipkin_2.11-6.34.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-app_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-app_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-app_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-app_2.11/6.33.0-SNAPSHOT/util-app_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-app_2.11/6.33.0-SNAPSHOT/util-app_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-core_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-core_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-core_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-core_2.11/6.33.0-SNAPSHOT/util-core_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-core_2.11/6.33.0-SNAPSHOT/util-core_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-events_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-events_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-events_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-events_2.11/6.33.0-SNAPSHOT/util-events_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-events_2.11/6.33.0-SNAPSHOT/util-events_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-jvm_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-jvm_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-jvm_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-jvm_2.11/6.33.0-SNAPSHOT/util-jvm_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-jvm_2.11/6.33.0-SNAPSHOT/util-jvm_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-lint_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-lint_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-lint_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-lint_2.11/6.33.0-SNAPSHOT/util-lint_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-lint_2.11/6.33.0-SNAPSHOT/util-lint_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-logging_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-logging_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-logging_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-logging_2.11/6.33.0-SNAPSHOT/util-logging_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-logging_2.11/6.33.0-SNAPSHOT/util-logging_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving com.twitter#util-registry_2.11;6.33.0-SNAPSHOT ...
[warn]  module not found: com.twitter#util-registry_2.11;6.33.0-SNAPSHOT
[warn] ==== local: tried
[warn]   /Users/cthaling/.ivy2/local/com.twitter/util-registry_2.11/6.33.0-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/twitter/util-registry_2.11/6.33.0-SNAPSHOT/util-registry_2.11-6.33.0-SNAPSHOT.pom
[warn] ==== twitter-repo: tried
[warn]   https://maven.twttr.com/com/twitter/util-registry_2.11/6.33.0-SNAPSHOT/util-registry_2.11-6.33.0-SNAPSHOT.pom
[info] Resolving jline#jline;2.12.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.twitter#finagle-core_2.11;6.34.0-SNAPSHOT: not found
[warn]  :: com.twitter#finagle-http_2.11;6.34.0-SNAPSHOT: not found
[warn]  :: com.twitter#finagle-zipkin_2.11;6.34.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-app_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-core_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-events_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-jvm_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-lint_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-logging_2.11;6.33.0-SNAPSHOT: not found
[warn]  :: com.twitter#util-registry_2.11;6.33.0-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.twitter:util-core_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-registry_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:finagle-zipkin_2.11:6.34.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-app_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:finagle-http_2.11:6.34.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-events_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:finagle-core_2.11:6.34.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-logging_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-lint_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
[warn]      com.twitter:util-jvm_2.11:6.33.0-SNAPSHOT (/Users/cthaling/twitter-server/project/Build.scala#L116)
[warn]        +- com.twitter:twitter-server_2.11:1.19.0-SNAPSHOT ()
sbt.ResolveException: unresolved dependency: com.twitter#finagle-core_2.11;6.34.0-SNAPSHOT: not found
unresolved dependency: com.twitter#finagle-http_2.11;6.34.0-SNAPSHOT: not found
unresolved dependency: com.twitter#finagle-zipkin_2.11;6.34.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-app_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-core_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-events_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-jvm_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-lint_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-logging_2.11;6.33.0-SNAPSHOT: not found
unresolved dependency: com.twitter#util-registry_2.11;6.33.0-SNAPSHOT: not found
    at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:294)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
    at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
    at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
    at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
    at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
    at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
    at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
    at xsbt.boot.Using$.withResource(Using.scala:10)
    at xsbt.boot.Using$.apply(Using.scala:9)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
    at sbt.IvySbt.withIvy(Ivy.scala:127)
    at sbt.IvySbt.withIvy(Ivy.scala:124)
    at sbt.IvySbt$Module.withModule(Ivy.scala:155)
    at sbt.IvyActions$.updateEither(IvyActions.scala:168)
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1392)
    at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1388)
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1422)
    at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1420)
    at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1425)
    at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1419)
    at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
    at sbt.Classpaths$.cachedUpdate(Defaults.scala:1442)
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1371)
    at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1325)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[error] (twitter-server/*:update) sbt.ResolveException: unresolved dependency: com.twitter#finagle-core_2.11;6.34.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#finagle-http_2.11;6.34.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#finagle-zipkin_2.11;6.34.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-app_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-core_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-events_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-jvm_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-lint_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-logging_2.11;6.33.0-SNAPSHOT: not found
[error] unresolved dependency: com.twitter#util-registry_2.11;6.33.0-SNAPSHOT: not found
[error] Total time: 6 s, completed Mar 31, 2016 4:11:17 PM

Upgrade to Jackson version and remove deprecated API

Problem

Lf2SpacesIndenter in DefaultPrettyPrinter deprecated since 2.5 and removed in 2.7.

DefaultPrettyPrinter.Lf2SpacesIndenter
Deprecated.
Since 2.5 use DefaultIndenter instead

Some libraries which depends on jackson 2.7 have trouble like below.


java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/util/DefaultPrettyPrinter$Lf2SpacesIndenter

printer.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter)

  private[this] val writer = {
    val mapper = new ObjectMapper().registerModule(DefaultScalaModule)
    val printer = new DefaultPrettyPrinter
    // this code not valid in jackson 2.7
    printer.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter) 
    mapper.writer(printer)
  }

Solution

  private[this] val writer = {
    val mapper = new ObjectMapper().registerModule(DefaultScalaModule)
    val printer = new DefaultPrettyPrinter
   // upgrade jackson verison and use new API
    printer.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE) 
    mapper.writer(printer)
  }

Related issue : twitter/finatra#276

Server shutdown - Get instead of POST

When I click shutdown in the admin server and click OK the request sent is GET instead of POST. The UI should be updated to send POST request.

Expected behavior

Shutdown the server

Actual behavior

Server returns 405 Method Not Allowed

Steps to reproduce the behavior

  • Run the server using finatra 2.12.0
  • Go to admin server
  • Click shutdown link in the utilities section
  • Press Ok

Where is `snowflake id` in this repo?

Hi thanks for the repo! I wonder where is snowflake id in this repo? I came from the old snowflake repo, which said that the newer code is here. But after a search I cannot find anything related to id generation :(

Expected behavior

See the snowflake id source code.

Actual behavior

Not see.

Steps to reproduce the behavior

Look at it.

Logging Trait mixin: asyncFlag and asyncMaxSizeFlag unavailable

When using the logging trait as a mixin, the asyncFlag and asyncMaxSizeFlag are unavailable due to being marked as private. All other flags are protected so they can get accessed in the child.

Expected behavior

Accessing asyncFlag and asyncMaxSizeFlag should be possible.

Actual behavior

Both flags are marked as private.

Steps to reproduce the behavior

Override handlers def as advised in the method comment.

package util

import com.twitter.logging.{ConsoleHandler, Handler, QueueingHandler, SyslogHandler, Logging => TwitterLogging}

trait Logging {
  self: TwitterLogging =>

  override def handlers: List[() => Handler] = {
    val output = outputFlag()
    val level = Some(levelFlag())
    val consoleHandler = ConsoleHandler(defaultFormatter, level)
    val syslogHandler = SyslogHandler(output, SyslogHandler.DEFAULT_PORT, defaultFormatter, level)

    if (asyncFlag()) {
      List(
        QueueingHandler(consoleHandler, asyncMaxSizeFlag(), inferClassNamesFlag()),
        QueueingHandler(syslogHandler, asyncMaxSizeFlag(), inferClassNamesFlag())
      ) 
    } else {
      List(
        consoleHandler,
        syslogHandler
      )
    }
  }
}

sbt assembly fails

sbt assembly fails with new project with no other dependencies.

Expected behavior

sbt assembly should create a fat jar.

Actual behavior

It fails to create a fat jar..

Steps to reproduce the behavior

We created an empty sbt project with the following build.sbt:

name := "tsdeptest"

version := "1.0"

scalaVersion := "2.11.8"


resolvers ++= Seq(
  "twttr" at "https://maven.twttr.com/"
)

libraryDependencies ++= {
  val twitterServerVersion = "1.26.0"
  Seq(
    "com.twitter" %% "twitter-server" % twitterServerVersion
  )
}

val meta = """META.INF(.)*""".r

assemblyMergeStrategy in assembly := {
  case meta(_) => MergeStrategy.discard
  case x =>
    val oldStrategy = (assemblyMergeStrategy in assembly).value
    oldStrategy(x)
}

This in plugins.sbt:

logLevel := Level.Warn

resolvers += Resolver.sonatypeRepo("public")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.1")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")

Running sbt clean assembly fails with the following:

[error] 1 error was encountered during merge
java.lang.RuntimeException: deduplicate: different file contents found in the following:
/Users/fernandezlopezg/.ivy2/cache/com.twitter/twitter-server_2.11/jars/twitter-server_2.11-1.25.0.jar:BUILD
/Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-http_2.11/jars/finagle-http_2.11-6.40.0.jar:BUILD
/Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-netty4_2.11/jars/finagle-netty4_2.11-6.40.0.jar:BUILD
/Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-thrift_2.11/jars/finagle-thrift_2.11-6.40.0.jar:BUILD
	at sbtassembly.Assembly$.applyStrategies(Assembly.scala:140)
	at sbtassembly.Assembly$.x$1$lzycompute$1(Assembly.scala:25)
	at sbtassembly.Assembly$.x$1$1(Assembly.scala:23)
	at sbtassembly.Assembly$.stratMapping$lzycompute$1(Assembly.scala:23)
	at sbtassembly.Assembly$.stratMapping$1(Assembly.scala:23)
	at sbtassembly.Assembly$.inputs$lzycompute$1(Assembly.scala:67)
	at sbtassembly.Assembly$.inputs$1(Assembly.scala:57)
	at sbtassembly.Assembly$.apply(Assembly.scala:83)
	at sbtassembly.Assembly$$anonfun$assemblyTask$1.apply(Assembly.scala:240)
	at sbtassembly.Assembly$$anonfun$assemblyTask$1.apply(Assembly.scala:237)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:235)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] /Users/fernandezlopezg/.ivy2/cache/com.twitter/twitter-server_2.11/jars/twitter-server_2.11-1.25.0.jar:BUILD
[error] /Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-http_2.11/jars/finagle-http_2.11-6.40.0.jar:BUILD
[error] /Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-netty4_2.11/jars/finagle-netty4_2.11-6.40.0.jar:BUILD
[error] /Users/fernandezlopezg/.ivy2/cache/com.twitter/finagle-thrift_2.11/jars/finagle-thrift_2.11-6.40.0.jar:BUILD
[error] Total time: 30 s, completed 06-Jan-2017 10:45:10

Txt verification code doesn't work in the Isle of Man 0044 7624 ......

Trying for several hours with various mobile phones that have never even visited twitter befoe, I tried to get verified on the web ( not using a phone to use twitter) with a 0044 7624 ****** number and the code never came through.

You desperately need to include a message to say the phone has been used before,or accept the above types of numbers for the Isle of Man.

This seriously grinds my gears.

/admin/metrics.json endpoint?

Hello!

I'm trying to access to the metrics endpoint described in the documentation :
http://twitter.github.io/twitter-server/Features.html#metrics

It should be under /admin/metrics.json, but it doesn't work for me (I'm using 1.0.1, and simply trying the AdvancedServer code).
Is this endpoint really implemented?

There's no handler for this endpoint in the Admin.scala source code :
https://github.com/twitter/twitter-server/blob/master/src/main/scala/com/twitter/server/Admin.scala

Everything else seems working fine

2.12-ification

In order to support 2.12, we need to add crossScalaVersions to Build.scala, and make sure everything compiles. Not every scala library will be built against the current snapshot, so we may have to support different versions from 2.11 to 2.12. If part of an API has churned (scalacheck in particular is susceptible to this) we may need to upgrade the 2.11 library version to make progress. If that happens, contact me (@mosesn) and I'll navigate the upgrade for you–it's a little complicated because we will need to upgrade all of our internal libraries, not just scrooge. Please note that most of this upgrade will not be feasible until we have a portion of util and finagle already upgraded.

Support for SLF4J logging

Are there any plans to move towards SLF4J instead of java.util.logging? As I see twitter-util already has an implementation and in the readme, they say "It is recommended that users move to using util-slf4j-api over util-logging."

Running REST service and admin endpoint on the same port

Why:

  • less ports to allocate and remember if running REST service. Every java application has two ports exposed (JMX and HTTP). Having three (JMX, HTTP, HTTP admin) seems like overkill

Problem:

  • AdminHttpServer is not configurable and is not really suited for production use. E.g. it overwrites 404 responses, has stats collection disabled, uses hardcoded 404 handler.

Solution:
Let client obtain instance of localMuxer from AdminHttpServer.updateMuxer()

That's how I have to do right now:

class X extends  com.twitter.app.App with AdminHttpServer with Admin {
    val allRoutes = routes
    //copy-pasted from AdminHttpServer.updateMuxer
    //with additional hacks to access package-protected ServerRegistry and ClientRegistry
    //it returns instance of localMuxer, i.e. Service that serves /admin endpoint
    def updateMuxer(): Service[Request, Response] = { ..... }
}

Also, ServerAdmissionControl is package-protected. Is that intentional?

Twitter-server 1.19.0
Finagle 6.34.0
Scala 2.11.7

Incorrect error message

I am using twitter's 'application only auth' for my application. In my code I try to create user list for which I do not have access. However, instead of getting a authentication or access issue, I am getting the below error:

This code is used when requests are being denied due to update limits

Add -dtab.add flag to twitter-server.

I was about to add a dtab.add flag to TwitterServer for my own needs, but maybe there's an implementation floating around at Twitter that you might just promote to twitter-server? ;)

Pretty please?

Inconsistent Documentation in index.css

Overview

While integrating updates and conducting a review of the index.css within the Twitter Server repository, I encountered significant inconsistencies in documentation across different CSS sections. This inconsistency affects the ease of understanding and maintaining the stylesheet, especially for new contributors or during debugging processes.

Issue Description

The documentation style and detail level vary noticeably between sections within the index.css file. Some parts of the stylesheet, like the base styling for html and body, are not documented, leaving room for interpretation about their intended use. Contrastingly, other sections, such as navigation styles (#wrapper, #sidebar, #toggle), contain comments but lack a consistent structure or detail level that explains their purpose or how they should be used or modified.

For example:

/* Base styles for the document */
html, body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}

/* Navigation */
#wrapper {
  /* Transition effect for sidebar */
  transition: all 0.5s ease;
}

Suggested Improvement

To enhance the maintainability, readability, and overall developer experience, I propose a structured approach to documenting the CSS. Each major section and style rule should be accompanied by comments that explain:

  • The purpose of the style or section.
  • Any dependencies or related styles.
  • Recommendations for modifications or cautions.

Expected Benefits

Standardizing the documentation within index.css will offer numerous benefits:

  • Improved Readability: Making it easier for developers to understand the stylesheet's structure and specific style purposes.
  • Enhanced Maintainability: Simplified updates and modifications due to a clear understanding of each style section.
  • Better Onboarding: New contributors can quickly get up to speed with the project's styling conventions and requirements.

Conclusion

Uniform and detailed documentation within index.css is crucial for leveraging the stylesheet's full capabilities efficiently. By adopting a standardized documentation approach, we can significantly improve the usability of the Twitter Server repository and foster a more collaborative and productive development environment.

Thank you for considering this enhancement to improve the Twitter Server project.

admin/metrics watch polling not working

It looks like the javascript that fetches the metric name from the URL is not working correctly. If you take a look at the network tab it keeps hitting ?m=undefined

image

expose process environment variables from /admin

i'd like a way to capture a process's environment variables and system properties at runtime from its admin interface.

i'm happy to implement this myself--just wanted to document the issue on this so it's tracked.

Online form submission code throws an error

Describe the bug
Online form submission code throws an error
To Reproduce
Steps to reproduce the behavior:
Try to send online form.

Expected behavior
Form should be submitted.
Screenshots
If applicable, add screenshots to help explain your problem.

Environment
Desktop, Linux.

Additional context
Not sure why my account is being locked in the first place.

Screenshot_2021-09-17_07-32-20

Binary incompatibility between twitter-server and finagle 6.20.0

There appears to be a binary incompatibility between twitter-server 1.7.3 and finagle 6.20.0 (finagle 6.18.0 works just fine) when attempting to use the -help GlobalFlag. Other defined global flags can be used just fine, however -help breaks with the following exception:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at com.twitter.app.ClassPath$Info.load(ClassPath.scala:40)
        at com.twitter.app.GlobalFlag$$anonfun$getAll$1.apply(Flag.scala:656)
        at com.twitter.app.GlobalFlag$$anonfun$getAll$1.apply(Flag.scala:655)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
        at com.twitter.app.GlobalFlag$.getAll(Flag.scala:655)
        at com.twitter.app.Flags.usage(Flag.scala:504)
        at com.twitter.app.Flags.parseArgs(Flag.scala:402)
        at com.twitter.app.App$class.main(App.scala:123)
        at io.github.benwhitehead.finch.Main$.main(Main.scala:8)
        at io.github.benwhitehead.finch.Main.main(Main.scala)

Steps to reproduce:

git clone [email protected]:BenWhitehead/finch-server.git
cd finch-server
git checkout -b twitter-server-binary-incompatibility origin/twitter-server-binary-incompatibility
sbt assembly
java -jar target/scala-2.10/finch-server-assembly-0.1-SNAPSHOT.jar -help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.