introspection

package
v0.0.0-...-8ff1004 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 18 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWorker

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

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

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.

Types

type Config

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

func (c *Config) Validate() error

Validate checks the config values to assert they are valid to create the 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 IntrospectionReporter

type IntrospectionReporter interface {
	IntrospectionReport() string
}

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

type ReportSources

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

type ValueSort []presence.Value

func (ValueSort) Len

func (a ValueSort) Len() int

func (ValueSort) Less

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

func (ValueSort) Swap

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

Directories

Path Synopsis
Package pprof is a fork of net/http/pprof modified to communicate over a unix socket.
Package pprof is a fork of net/http/pprof modified to communicate over a unix socket.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL