Documentation ¶
Overview ¶
Package admin implements an HTTP server providing useful information & tools about this server.
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDigest(name string) ([sha256.Size]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func AssetString(name string) (string, error)
- func Digests() (map[string][sha256.Size]byte, error)
- func LoggingHandler(writer http.ResponseWriter, request *http.Request)
- func MetricQueryHandler(w http.ResponseWriter, r *http.Request)
- func MustAsset(name string) []byte
- func MustAssetString(name string) string
- func PingHandler(w http.ResponseWriter, r *http.Request)
- func RedirectHandler(url string, code int) http.Handler
- func ResourceHandler(baseRequestPath, baseResourcePath string) http.Handler
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Serve(opts Opts)
- func ServeOnce(opts Opts)
- func SummaryHandler(w http.ResponseWriter, r *http.Request)
- func UpdateLoggingHandler(writer http.ResponseWriter, request *http.Request)
- type HTTPServer
- type Logger
- type LoggerInfo
- type Opts
- type Route
Constants ¶
This section is empty.
Variables ¶
var ( ProcessInfoGroup = "Process Info" PerfProfileGroup = "Performance Profile" UtilitiesGroup = "Utilities" MetricsGroup = "Metrics" )
Top level groups for the Sidebar nav
var ( RootPath = "/" AdminPath = "/admin" ClientsPath = AdminPath + "/clients/" ServersPath = AdminPath + "/servers/" FilesPath = AdminPath + "/files/" )
Well known paths
var DefaultAdminHTTPServer = &HTTPServer{}
DefaultAdminHTTPServer is the global admin http server.
var Gatherer = prometheus.DefaultGatherer
Gatherer is the thing we gather metrics from.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDigest ¶
AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetString ¶
AssetString returns the asset contents as a string (instead of a []byte).
func LoggingHandler ¶
func LoggingHandler(writer http.ResponseWriter, request *http.Request)
LoggingHandler returns the current state of all loggers that we know about.
func MetricQueryHandler ¶
func MetricQueryHandler(w http.ResponseWriter, r *http.Request)
MetricQueryHandler either renders the list of all metrics and a graph, or returns the queried metrics' current values.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func MustAssetString ¶
MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.
func PingHandler ¶
func PingHandler(w http.ResponseWriter, r *http.Request)
PingHandler serves a very simple response that can be used as a health check.
func RedirectHandler ¶
RedirectHandler avoids the default behaviour of writing random html into the response.
func ResourceHandler ¶
ResourceHandler returns the asset, relative to the given paths.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory.
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively.
func SummaryHandler ¶
func SummaryHandler(w http.ResponseWriter, r *http.Request)
SummaryHandler renders the front-page content.
func UpdateLoggingHandler ¶
func UpdateLoggingHandler(writer http.ResponseWriter, request *http.Request)
UpdateLoggingHandler associates a new log level with a given module. There is no way of telling if the module has a custom level or if it is "falling back" to the root module, so this does nothing clever.
Types ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is a holder for the router and server involved in serving the admin UI.
type Logger ¶
type Logger interface { Debugf(msg string, args ...interface{}) Infof(msg string, args ...interface{}) Warningf(msg string, args ...interface{}) Errorf(msg string, args ...interface{}) }
A Logger is the interface we log to.
type LoggerInfo ¶
type LoggerInfo interface { // ModuleLevels returns a map of all known modules and their level ModuleLevels() map[string]logging.Level // SetLevel sets the level of a logging module. SetLevel(level logging.Level, module string) }
LoggerInfo is the interface we need from something that can describe & update log levels.
type Opts ¶
type Opts struct { Disabled bool `long:"disabled" description:"If true, the admin server will never start." env:"ADMIN_DISABLE_HTTP"` Port int `long:"port" default:"9990" description:"The port to listen on."` Logger Logger `no-flag:"true"` LogInfo LoggerInfo `no-flag:"true"` }
Opts is all flags associated with the admin HTTP server.