Documentation
¶
Overview ¶
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 ¶
- Variables
- func NewWorker(config Config) (worker.Worker, error)
- func UpdateProfileFunctions(io FileReaderWriter, profileDir string) error
- func WriteProfileFunctions(profileDir string) error
- type Clock
- type Config
- type DepEngineReporter
- type FileReaderWriter
- type Reporter
- type SimpleHub
- type StructuredHub
- type ValueSort
Constants ¶
This section is empty.
Variables ¶
var (
// ProfileDir is the directory where the profile script is written.
ProfileDir = "/etc/profile.d"
)
Functions ¶
func NewWorker ¶
NewWorker starts an http server listening on an abstract domain socket which will be created with the specified name.
func UpdateProfileFunctions ¶
func UpdateProfileFunctions(io FileReaderWriter, profileDir string) error
UpdateProfileFunctions updates the shellFuncs written to disk if they have changed to the directory passed in. It allows all bash terminals to easily access the introspection worker.
func WriteProfileFunctions ¶
WriteProfileFunctions writes the shellFuncs below to a file in the /etc/profile.d directory so all bash terminals can easily access the introspection worker. Deprecated: use UpdateProfileFunction with a FileReaderWriter.
Types ¶
type Config ¶
type Config struct { SocketName string DepEngine DepEngineReporter StatePool Reporter PubSub Reporter MachineLock machinelock.Lock PrometheusGatherer prometheus.Gatherer Presence presence.Recorder Clock Clock LocalHub SimpleHub CentralHub StructuredHub }
Config describes the arguments required to create the introspection worker.
type DepEngineReporter ¶
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 FileReaderWriter ¶
type FileReaderWriter interface { ReadFile(filename string) ([]byte, error) WriteFile(filename string, data []byte, perm os.FileMode) error }
FileReaderWriter for mocking file reads and writes.
type Reporter ¶
type Reporter interface {
IntrospectionReport() string
}
Reporter provides a simple method that the introspection worker will output for the entity.
type SimpleHub ¶
type SimpleHub interface { Publish(topic string, data interface{}) func() Subscribe(topic string, handler func(string, interface{})) func() }
SimpleHub is a pubsub hub used for internal messaging.