heartbeat

package
v0.0.2-0...-4ce78c8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricName

func MetricName(moduleName string) string

MetricName is used to determine the metric name for a given module

func SystemProbeEnabledModules

func SystemProbeEnabledModules() ([]string, error)

SystemProbeEnabledModules returns a list of all system-probe modules that are running

Types

type ModuleMonitor

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

ModuleMonitor is responsible for emitting heartbeat metrics for each system-probe module. It does so by hitting the stats endpoint from system-probe and emitting one metric per enabled module using Datadog Public API.

func NewModuleMonitor

func NewModuleMonitor(opts Options) (*ModuleMonitor, error)

NewModuleMonitor returns a new ModuleMonitor

func (*ModuleMonitor) Every

func (m *ModuleMonitor) Every(interval time.Duration, modules ...string)

Every can be used to automatically send heartbeats based on the given time interval.

func (*ModuleMonitor) Heartbeat

func (m *ModuleMonitor) Heartbeat(modules ...string)

Heartbeat emits one heartbeat metric for each system-probe module that is enabled. The argument `modules` filters which heartbeats should be emitted. If no argument is given all enabled modules are reported.

func (*ModuleMonitor) Stop

func (m *ModuleMonitor) Stop()

Stop flushing the heartbeats

type Options

type Options struct {
	// KeysPerDomain (required) contains API key entries per Datadog domain
	KeysPerDomain map[string][]string

	// HostName (required)
	HostName string

	// SysprobeSocketPath (optional) sets the location of the Unix socket used
	// to reach system-probe
	SysprobeSocketPath string

	// StatsdClient (optional) points to a statsd client to be used as a
	// fallback mechanism
	StatsdClient statsd.ClientInterface

	// TagVersion (optional) contains the agent version to be sent along with the
	// heartbeat metric
	TagVersion string

	// TagRevision (optional) contains the agent revision to be sent along with the
	// heartbeat metric
	TagRevision string

	// MetricNameFn (optional) allows metric names to be specified
	MetricNameFn func(string) string
}

Options encapsulates all configuration params used by ModuleMonitor

Jump to

Keyboard shortcuts

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