Documentation ¶
Overview ¶
Package statuspages provide tools to implement status pages on your services.
Index ¶
Constants ¶
const End = `` /* 325-byte string literal not displayed */
Variables ¶
var ( // Begin is the start of status pages, End is the end. Begin *template.Template )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(s *Server)
func WithBindRootPath ¶
func WithBindRootPath() Option
WithBindRootPath will bind the root path "/" to the status pages. This is useful when the web server is dedicated to status pages, and should be avoided if the web server is also used for another purpose. The /status path is always bound anyway.
func WithHttpServer ¶
WithHttpServer allows users to provide their own http server.
func WithListener ¶
WithListener allows users to provide their own listener.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server (statuspages.Server) is a status pages HTTP server.
func (*Server) AddHandler ¶
AddHandler adds a http handler to the status pages web server.
func (*Server) AddService ¶
Add a new service on the status page. If another service with this name alreay exists, a suffix will be appended to the service name. The possibly suffixed service name is returned, then passed back to each Service.MainPageEntry and Service.ServicePage calls. If the service is already registred, this has no effect and returns the current name.
func (*Server) RemoveService ¶
RemoveService removes a service from the status page. This has no effect if the service is not registered.
type Service ¶
type Service interface { // MainPageEntry returns a HTML snippet to include on the main page. MainPageEntry(name string) (string, error) // ServicePage handle requests to this service. ServicePage(name string, w http.ResponseWriter, r *http.Request) error }
Service handles requests to /status pages.