metric

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CpuLabel    = "cpu"
	MemoryLabel = "memory"
)

Variables

View Source
var Component = compogo.Component{
	Name: "resource.metrics",
	Dependencies: compogo.Components{
		&manager.Component,
	},
	Init: compogo.StepFunc(func(container compogo.Container) error {
		return container.Provide(NewMetric)
	}),
	PreExecute: compogo.StepFunc(func(container compogo.Container) error {
		return container.Invoke(func(m *manager.Manager, metric *Metric) {
			m.OnChangeResource.Subscribe(metric.OnChangeResource)
		})
	}),
}

Component — компонент метрик ресурсов. Подписывается на изменения ресурсов и обновляет метрики.

Functions

This section is empty.

Types

type Metric

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

Metric — сборщик метрик ресурсов. Собирает метрики лимитов и использования CPU и Memory.

func NewMetric

func NewMetric(compogoConfig *compogo.Config) *Metric

NewMetric создаёт новый сборщик метрик.

func (*Metric) OnChangeResource

func (metric *Metric) OnChangeResource(_ context.Context, resource *domain.Resource)

OnChangeResource вызывается при изменении ресурсов. Обновляет метрики.

Jump to

Keyboard shortcuts

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