monitoring

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvMonitoringEnabled = envPrefix + "ENABLED"

	// EnvMetricsEndpoint is the metrics endpoint to use
	EnvMetricsEndpoint = envPrefix + "METRICS_ENDPOINT"

	// EnvPollingInterval is the polling interval to run the GPU metrics poller
	EnvPollingInterval = envPrefix + "POLLING_INTERVAL"
)

Environment variable keys.

View Source
const (
	MetricsComponentName = "KaiwoResourceMonitor"
)

Variables

This section is empty.

Functions

func GetKaiwoWorkload

func GetKaiwoWorkload(ctx context.Context, k8sClient client.Client, name string, namespace string, workloadType string) (common.KaiwoWorkload, error)

func IsMetricsMonitoringEnabled

func IsMetricsMonitoringEnabled() bool

func ParseIntervalFromEnv added in v0.1.5

func ParseIntervalFromEnv(envVar string) (time.Duration, error)

ParseIntervalFromEnv retrieves a duration from an environment variable.

Types

type GpuMetricsEntry added in v0.1.5

type GpuMetricsEntry struct {
	Namespace             string
	PodName               string
	ContainerName         string
	GpuID                 string
	GpuPartitionID        string
	UtilizationPercentage float64
	AssociatedPod         *corev1.Pod
}

func (*GpuMetricsEntry) IsValid added in v0.1.5

func (entry *GpuMetricsEntry) IsValid() bool

func (*GpuMetricsEntry) Key added in v0.1.5

func (entry *GpuMetricsEntry) Key() string

type MetricsWatcher

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

MetricsWatcher polls Prometheus and updates Kaiwo statuses.

func NewMetricsWatcher

func NewMetricsWatcher(
	endpoint string,
	pollInterval time.Duration,
	k8sClient client.Client,
	scheme *runtime.Scheme,
	recorder record.EventRecorder,
) (*MetricsWatcher, error)

NewMetricsWatcher creates a watcher; check template.Err on parse.

func NewMetricsWatcherFromEnv

func NewMetricsWatcherFromEnv(
	k8sClient client.Client,
	scheme *runtime.Scheme,
	recorder record.EventRecorder,
) (*MetricsWatcher, error)

NewMetricsWatcherFromEnv constructs a MetricsWatcher from environment variables.

func (*MetricsWatcher) Start

func (m *MetricsWatcher) Start(ctx context.Context) error

Start runs the periodic poll loop until ctx.Done().

Jump to

Keyboard shortcuts

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