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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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