Package

com.twitter

server

Permalink

package server

Twitter Server

Provides a common configuration setup for internal Twitter servers based on com.twitter.app.App.

An HTTP server is bound to a configurable port (default: 9900) to which commands can be sent and information queried. Additional handlers can be provided by adding them to com.twitter.finagle.http.HttpMuxer.

object MyServer extends TwitterServer {
  def main() {
    // start my service
  }
}

Provided handlers

See com.twitter.server.TwitterServer

Configuration

The default port is set via defaultAdminPort. This can be overridden in the super class or set on the command line with -admin.port.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. server
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractTwitterServer extends TwitterServer

    Permalink

    A Java-friendly version of the TwitterServer.

    A Java-friendly version of the TwitterServer.

    In addition to TwitterServer, this abstract class defines its own Java-friendly lifecycle methods onInit, preMain, postMain and onExit that might be overridden in a concrete class.

    In order to launch the AbstractTwitterServer instance, the main method should be explicitly defined. It makes sense to define it within an inner class Main as shown below.

    public class JavaServer extends AbstractTwitterServer {
      public static class Main {
        public static void main(String[] args) {
          new JavaServer().main(args);
        }
      }
    }

    The Main class containing the main method may be launched via java JavaServer$Main.

  2. trait Admin extends AnyRef

    Permalink

    Defines many of the default /admin/ HTTP routes.

  3. trait AdminHttpServer extends AnyRef

    Permalink
  4. class FlagAnnouncer extends Announcer

    Permalink
  5. class FlagResolver extends Resolver

    Permalink
  6. trait Hook extends AnyRef

    Permalink

    Defines a hook into an App.

  7. trait Hooks extends AnyRef

    Permalink

    Mix-in to include service-loaded hooks.

  8. trait Lifecycle extends AnyRef

    Permalink
  9. trait Linters extends AnyRef

    Permalink

    Registers any global linter rules.

  10. class NamedResolverNotFoundException extends Exception

    Permalink

    Indicates that a com.twitter.finagle.Resolver was not found for the given name using the FlagResolver.

    Indicates that a com.twitter.finagle.Resolver was not found for the given name using the FlagResolver.

    Resolvers are discovered via the com.twitter.server.resolverMap

  11. trait NewHook extends (App) ⇒ Hook

    Permalink

    Create a new hook for the given App.

    Create a new hook for the given App. NewHooks are service-loaded.

  12. trait Stats extends AnyRef

    Permalink
  13. trait TwitterServer extends App with Slf4jBridge with Logging with Linters with Hooks with AdminHttpServer with Admin with Lifecycle with Stats

    Permalink

    Twitter Server defines a template from which servers at Twitter are built.

    Twitter Server 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.

    For DI (Dependency Injection) Twitter Server uses self-typed Scala traits that might be mixed in the TwitterServer trait. The common practice is to define self-typed traits against the App trait as shown below.

    import com.twitter.app.App
    import com.twitter.server.TwitterServer
    
    trait MyModule { self: App =>
      // module logic
    }
    
    object MyApp extends TwitterServer with MyModule {
      // app logic
    }

    Note: the Slf4jBridge trait MUST be defined first to properly bridge legacy logging APIs.

  14. trait ShadowAdminServer extends AnyRef

    Permalink

    An admin http server which serves requests outside the default finagle worker pool.

    An admin http server which serves requests outside the default finagle worker pool. This server shadows vital endpoints (ex. stats) that are useful for diagnostics and should be available even if the server becomes overwhelmed.

    Note, we don't serve all of /admin on a separate worker pool because it's important to serve certain admin endpoints in-band with the server. In particular, /health and /ping should be served in-band so that they are an accurate proxy of server health.

    Annotations
    @deprecated
    Deprecated

    (Since version 2017-10-04)

Value Members

  1. object Admin

    Permalink
  2. object AdminHttpServer

    Permalink
  3. object Lifecycle

    Permalink
  4. object announcerMap extends GlobalFlag[Map[String, String]]

    Permalink
  5. package handler

    Permalink
  6. package lint

    Permalink
  7. object promoteBeforeServing extends GlobalFlag[Boolean]

    Permalink
  8. object resolverMap extends GlobalFlag[Map[String, String]]

    Permalink
  9. package util

    Permalink
  10. package view

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped