import "github.com/juju/juju/worker/introspection"
Package introspection defines the worker that can report internal agent state through the use of a machine local socket.
The most interesting endpoints at this stage are: * `/debug/pprof/goroutine?debug=1`
- prints out all the goroutines in the agent
* `/debug/pprof/heap?debug=1`
- prints out the heap profile
var ( // ProfileDir is the directory where the profile script is written. ProfileDir = "/etc/profile.d" )
NewWorker starts an http server listening on an abstract domain socket which will be created with the specified name.
func RegisterHTTPHandlers( sources ReportSources, handle func(path string, h http.Handler), )
AddHandlers calls the given function with http.Handlers that serve agent introspection requests. The function will be called with a path; the function may alter the path as it sees fit.
WriteProfileFunctions writes the bashFuncs below to a file in the /etc/profile.d directory so all bash terminals can easily access the introspection worker.
type Config struct { SocketName string DepEngine DepEngineReporter StatePool IntrospectionReporter PubSub IntrospectionReporter MachineLock machinelock.Lock PrometheusGatherer prometheus.Gatherer Presence presence.Recorder }
Config describes the arguments required to create the introspection worker.
Validate checks the config values to assert they are valid to create the worker.
type DepEngineReporter interface { // Report returns a map describing the state of the receiver. It is expected // to be goroutine-safe. Report() map[string]interface{} }
DepEngineReporter provides insight into the running dependency engine of the agent.
IntrospectionReporter provides a simple method that the introspection worker will output for the entity.
type ReportSources struct { DependencyEngine DepEngineReporter StatePool IntrospectionReporter PubSub IntrospectionReporter MachineLock machinelock.Lock PrometheusGatherer prometheus.Gatherer Presence presence.Recorder }
ReportSources are the various information sources that are exposed through the introspection facility.
Path | Synopsis |
---|---|
pprof | Package pprof is a fork of net/http/pprof modified to communicate over a unix socket. |
Package introspection imports 18 packages (graph) and is imported by 25 packages. Updated 2019-10-22. Refresh now. Tools for package owners.