metrics

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ValueInletTemperature = "inlet_temp"
	ValueDeltaPressure    = "delta_p"
)
View Source
const MinInterval = 1 * time.Second

Variables

Functions

func CollectorKey

func CollectorKey(objKey types.NamespacedName, valueType ValueType) collectorKey

func StoreKey

func StoreKey(namespace, name string, info provider.CustomMetricInfo) storeKey

StoreKey constructs a storeKey.

Format: {namespace}/{resource.group}/{name} Examples:

  • Pod: "default/pods/pod0"
  • Node: "/nodes/node0"
  • Deployment: "default/deployments.apps/deploy0"

NOTE: CustomMetricInfo should be normalized with CustomMetricInfo.Normalized().

func StoreKeyForNode

func StoreKeyForNode(name string) storeKey

StoreKeyForNode constructs a storeKey for the given node name.

Format: nodes/{name}

Types

type Agent

type Agent interface {
	ValueType() ValueType
	Fetch(ctx context.Context) (value float64, err error)
}

type Collector

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

func (*Collector) Register

func (c *Collector) Register(k collectorKey, a Agent, s *Store, nodeName string, interval time.Duration, timeout time.Duration)

func (*Collector) Unregister

func (c *Collector) Unregister(k collectorKey)

type MetricData

type MetricData struct {
	InletTemp              float64
	InletTempTimestamp     time.Time
	DeltaPressure          float64
	DeltaPressureTimestamp time.Time
}

type Store

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

func (*Store) Get

func (s *Store) Get(k storeKey) (MetricData, bool)

Get returns a MetricData for the given storeKey. Thread-safe.

func (*Store) GetOrInit

func (s *Store) GetOrInit(k storeKey) MetricData

GetOrInit returns a MetricData for the given storeKey or inits it if not found. Thread-safe.

func (*Store) Set

func (s *Store) Set(k storeKey, m MetricData)

Set sets a MetricData. Thread-safe.

type ValueType

type ValueType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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