metrics

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PoolTimeInterval defines the period of time used by the Pusher to
	// publish the number of the checks de agent is running.
	PoolTimeInterval = time.Duration(5) * time.Second

	// PoolPeriod defines the time interval for pooling the agent for the
	// current number of checks running.
	PoolPeriod = 5
)

Functions

This section is empty.

Types

type Agent

type Agent interface {
	AbortCheck(ID string)
	ChecksRunning() int
}

Agent defines the functions an agent must expose for the Metrics to be able to gather metrics.

type Metrics

type Metrics struct {
	Enabled bool
	Client  metrics.Client
	Aborter Agent
	AgentID string
	Logger  log.Logger
}

Metrics sends the defined metrics for an agent to Data Dog.

func NewMetrics

func NewMetrics(l log.Logger, cfg config.DatadogConfig, aborter Agent) *Metrics

NewMetrics return a new struct which sends the defined metrics for the agent to DD.

func (*Metrics) AbortCheck

func (p *Metrics) AbortCheck(ID string)

AbortCheck just wraps the AbortCheck function of the "actual" check aborter in order to push metrics every time a new message has been received.

func (*Metrics) StartPolling

func (p *Metrics) StartPolling(ctx context.Context) <-chan struct{}

StartPolling pools every PoolIntervalSeconds the current number the agent is running and sends the metric to the Data Dog.

Jump to

Keyboard shortcuts

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