in server/src/main/scala/com/twitter/server/AdminHttpServer.scala [347:381]
private[this] def routeToIndexLink(route: Route): IndexView.Link =
IndexView.Link(route.alias, route.path, route.method)
/**
* Starts the server.
*
* By default the server starts automatically.
* If this is not desirable (e.g. to postpone replies from the /health endpoint)
* the server can be disabled with [[disableAdminHttpServer]].
* In the latter case the server can still be started manually with this method.
*/
protected def startAdminHttpServer(): Unit = {
val loggingMonitor = new Monitor {
def handle(exc: Throwable): Boolean = {
log.error(s"Caught exception in AdminHttpServer: $exc", exc)
false
}
}
log.info(s"Serving admin http on ${adminPort()}")
adminHttpServer = configureAdminHttpServer(
Http.server
.withStatsReceiver(NullStatsReceiver)
.withTracer(NullTracer)
.withMonitor(loggingMonitor)
.withLabel(ServerName)
// disable admission control, since we want the server to report stats
// especially when it's in a bad state.
.configured(ServerAdmissionControl.Param(false))
.configured(AdminServerInterface.True)
).serve(adminPort(), new NotFoundView andThen adminHttpMuxer)
closeOnExitLast(adminHttpServer)
Library.register(libraryName, Map.empty)
}