utilizationtracker

package module
v0.0.0-...-1b7481c Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package utilizationtracker provides a utility to track the utilization of a component.

Package utilizationtracker provides a utility to track the utilization of a component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UtilizationTracker

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

UtilizationTracker tracks the utilization of a component.

func NewUtilizationTracker

func NewUtilizationTracker(
	interval time.Duration,
	alpha float64,
) *UtilizationTracker

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

func (*UtilizationTracker) Finished

func (ut *UtilizationTracker) Finished()

Finished should be invoked when a compnent's work is complete so that we can calculate the utilization of the compoennt.

Produces one value on the Output channel.

func (*UtilizationTracker) Started

func (ut *UtilizationTracker) Started()

Started should be invoked when a compnent's work is about to being 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 component is about to exit so that we can clean up the instances resources.

func (*UtilizationTracker) Tick

func (ut *UtilizationTracker) Tick()

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

Produces one value on the Output channel.

Jump to

Keyboard shortcuts

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