monitor

package
v0.0.0-...-92e4890 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_CFG_SAMPLE_INTERVAL_SECS = 60
View Source
const DEFAULT_DIAG_SAMPLE_INTERVAL_SECS = 60
View Source
const DEFAULT_STATS_SAMPLE_INTERVAL_SECS = 1

Variables

This section is empty.

Functions

func SameNodeDefs

func SameNodeDefs(a, b *cbgt.NodeDefs) bool

Types

type MonitorCluster

type MonitorCluster struct {
	// contains filtered or unexported fields
}

A MonitorCluster struct holds all the tracking information for the StartMonitorCluster operation.

func StartMonitorCluster

func StartMonitorCluster(
	seedURLs []string,
	sampleCh chan MonitorSample,
	options MonitorClusterOptions,
) (*MonitorCluster, error)

StartMonitorCluster begins monitoring a cbgt cluster (as defined by a REST /api/cfg endpoint), including the handling of node membership changes.

TODO: Allow a monitoring of other MonitorCluster's in a hierarchy to support the scaling out to large number of cbgt nodes.

func (*MonitorCluster) Stop

func (m *MonitorCluster) Stop()

type MonitorClusterOptions

type MonitorClusterOptions struct {
	CfgSampleInterval   time.Duration // Ex: 1 * time.Second.
	MonitorNodesOptions MonitorNodesOptions

	// Optional, defaults to http.Get(); this is used, for example,
	// for unit testing.
	HttpGet func(url string) (resp *http.Response, err error)
}

type MonitorNodes

type MonitorNodes struct {
	// contains filtered or unexported fields
}

A MonitorNodes struct holds all the tracking information for the StartMonitorNodes operation.

func StartMonitorNodes

func StartMonitorNodes(
	urlUUIDs []UrlUUID,
	sampleCh chan MonitorSample,
	options MonitorNodesOptions,
) (*MonitorNodes, error)

StartMonitorNodes begins REST stats and diag sampling from a fixed set of cbgt nodes. Higher level parts (like StartMonitorCluster) should handle situations of node membership changes by stopping and restarting StartMonitorNodes() as needed.

The cbgt REST URL endpoints that are monitored are [url]/api/stats and [url]/api/diag.

func (*MonitorNodes) Stop

func (m *MonitorNodes) Stop()

type MonitorNodesOptions

type MonitorNodesOptions struct {
	StatsSampleInterval time.Duration // Ex: 1 * time.Second.
	StatsSampleDisable  bool

	DiagSampleInterval time.Duration
	DiagSampleDisable  bool

	// Optional, defaults to http.Get(); this is used, for example,
	// for unit testing.
	HttpGet func(url string) (resp *http.Response, err error)
}

type MonitorSample

type MonitorSample struct {
	Kind     string // Ex: "/api/cfg", "/api/stats", "/api/diag".
	Url      string // Ex: "http://10.0.0.1:8095".
	UUID     string
	Start    time.Time     // When we started to get this sample.
	Duration time.Duration // How long it took to get this sample.
	Error    error
	Data     []byte
}

MonitorSample represents the information collected during monitoring and sampling a node.

type UrlUUID

type UrlUUID struct {
	Url  string
	UUID string
}

UrlUUID associates a URL with a UUID.

func NodeDefsUrlUUIDs

func NodeDefsUrlUUIDs(nodeDefs *cbgt.NodeDefs) (r []UrlUUID)

Jump to

Keyboard shortcuts

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