introspection

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 27 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

View Source
var (
	// ProfileDir is the directory where the profile script is written.
	ProfileDir = "/etc/profile.d"
)

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 WriteProfileFunctions

func WriteProfileFunctions(profileDir string) 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 Clock

type Clock interface {
	Now() time.Time
	After(time.Duration) <-chan time.Time
}

Clock represents the ability to wait for a bit.

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
	Leases             Leases
}

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 Leases

type Leases interface {
	Snapshot() (raft.FSMSnapshot, error)
}

Leases provides the methods needed to expose the lease internals.

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{}) <-chan struct{}
	Subscribe(topic string, handler func(string, interface{})) func()
}

SimpleHub is a pubsub hub used for internal messaging.

type StructuredHub

type StructuredHub interface {
	Publish(topic string, data interface{}) (<-chan struct{}, error)
	Subscribe(topic string, handler interface{}) (func(), error)
}

StructuredHub is a pubsub hub used for messaging within the HA controller applications.

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