juju: github.com/juju/juju/worker/introspection Index | Files | Directories

package introspection

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

Index

Package Files

doc.go script.go socket.go

func NewWorker Uses

func NewWorker(config Config) (worker.Worker, error)

NewWorker starts an http server listening on an abstract domain socket which will be created with the specified name.

func RegisterHTTPHandlers Uses

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.

func WriteProfileFunctions Uses

func WriteProfileFunctions() error

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 Uses

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.

func (*Config) Validate Uses

func (c *Config) Validate() error

Validate checks the config values to assert they are valid to create the worker.

type DepEngineReporter Uses

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.

type IntrospectionReporter Uses

type IntrospectionReporter interface {
    IntrospectionReport() string
}

IntrospectionReporter provides a simple method that the introspection worker will output for the entity.

type ReportSources Uses

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.

type ValueSort Uses

type ValueSort []presence.Value

func (ValueSort) Len Uses

func (a ValueSort) Len() int

func (ValueSort) Less Uses

func (a ValueSort) Less(i, j int) bool

func (ValueSort) Swap Uses

func (a ValueSort) Swap(i, j int)

Directories

PathSynopsis
pprofPackage 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 19 packages. Updated 2018-09-02. Refresh now. Tools for package owners.