worker

package
v0.0.0-...-651a140 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckLogger

type CheckLogger struct {
	Check check.Check
	// contains filtered or unexported fields
}

CheckLogger is the object responsible for logging the information generated during the running of the check

func (*CheckLogger) CheckFinished

func (cl *CheckLogger) CheckFinished()

CheckFinished is used to log that the check has completed

func (*CheckLogger) CheckStarted

func (cl *CheckLogger) CheckStarted()

CheckStarted is used to log that the check is about to run

func (*CheckLogger) Debug

func (cl *CheckLogger) Debug(message string)

Debug is used to log a message for a check that may be useful in debugging

func (*CheckLogger) Error

func (cl *CheckLogger) Error(checkErr error)

Error is used to log an error that occurred during the invocation of the check

type UtilizationTracker

type UtilizationTracker struct {
	Output chan float64
	// contains filtered or unexported fields
}

func NewUtilizationTracker

func NewUtilizationTracker(
	workerName string,
	interval time.Duration,
) *UtilizationTracker

NewUtilizationTracker instantiates and configures a utilization tracker that calculates the values and publishes them to expvars

func (*UtilizationTracker) CheckFinished

func (ut *UtilizationTracker) CheckFinished()

CheckFinished should be invoked when a worker's check is complete so that we can calculate the utilization of the linked worker.

Produces one value on the Output channel.

func (*UtilizationTracker) CheckStarted

func (ut *UtilizationTracker) CheckStarted()

CheckStarted should be invoked when a worker's check is about to run so that we can track the start time and the utilization.

Produces one value on the Output channel.

func (*UtilizationTracker) Stop

func (ut *UtilizationTracker) Stop()

Stop should be invoked when a worker is about to exit so that we can remove the instance's expvars

func (*UtilizationTracker) Tick

func (ut *UtilizationTracker) Tick()

Tick updates to the utilization during intervals where no check were started or stopped.

Produces one value on the Output channel.

type Worker

type Worker struct {
	ID   int
	Name string
	// contains filtered or unexported fields
}

Worker is an object that encapsulates the logic to manage a loop of processing checks over the provided `PendingCheckChan`

func NewWorker

func NewWorker(
	senderManager sender.SenderManager,
	runnerID int,
	ID int,
	pendingChecksChan chan check.Check,
	checksTracker *tracker.RunningChecksTracker,
	shouldAddCheckStatsFunc func(id checkid.ID) bool,
) (*Worker, error)

NewWorker returns an instance of a `Worker` after parameter sanity checks are passed

func (*Worker) Run

func (w *Worker) Run()

Run waits for checks and run them as long as they arrive on the channel

Jump to

Keyboard shortcuts

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