Documentation ¶
Overview ¶
Package admin : - has a rpc over http server listening on a unix socket - support other packages to expose any admin functionality over the above server
Example for registering admin handler from another package ¶
// Add this while initializing the package in setup or init etc. admin.RegisterAdminHandler("PackageName", &PackageAdmin{}) admin.RegisterStatusHandler("PackageName", &PackageAdmin{})
// Convention is to keep the following code in admin.go in the respective package type PackageAdmin struct { }
// Status function is used for debug purposes by the admin interface
func (p *PackageAdmin) Status() map[string]interface{} { return map[string]interface{}{ "parameter-1" : value, "parameter-2" : value, } }
// The following function can be called from rudder-cli using getUDSClient().Call("PackageName.SomeAdminFunction", &arg, &reply)
func (p *PackageAdmin) SomeAdminFunction(arg *string, reply *string) error { *reply = "admin function output" return nil }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAdminHandler ¶
func RegisterAdminHandler(name string, handler interface{})
RegisterAdminHandler is used by other packages to expose admin functions over the unix socket based rpc interface
func StartServer ¶
StartServer starts an HTTP server listening on unix socket and serving rpc communication
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
func (*Admin) GetFormattedEnv ¶
GetFormattedEnv return the formatted env
func (*Admin) GetLoggingConfig ¶
GetLoggingConfig returns the logging configuration
func (*Admin) ServerConfig ¶
ServerConfig fetches current configuration as set in viper
type PackageStatusHandler ¶
type PackageStatusHandler interface {
Status() interface{}
}
PackageStatusHandler to be implemented by the package objects that are registered as status handlers output of Status() is expected to be json encodable by default