Documentation
¶
Index ¶
- Constants
- func GetKaiwoWorkload(ctx context.Context, k8sClient client.Client, name string, namespace string, ...) (common.KaiwoWorkload, error)
- func GetKaiwoWorkloadFromPod(ctx context.Context, k8sClient client.Client, namespace string, podName string) (common.KaiwoWorkload, error)
- func IsMetricsMonitoringEnabled() bool
- type MetricsWatcher
- type PrometheusResponse
- type PrometheusResult
Constants ¶
View Source
const ( EnvMonitoringEnabled = envPrefix + "ENABLED" // EnvPrometheusEndpoint is the Prometheus endpoint to use EnvPrometheusEndpoint = envPrefix + "PROMETHEUS_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 GetKaiwoWorkloadFromPod ¶
func IsMetricsMonitoringEnabled ¶
func IsMetricsMonitoringEnabled() bool
Types ¶
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.
type PrometheusResponse ¶
type PrometheusResponse struct {
Status string `json:"status"`
Data struct {
ResultType string `json:"resultType"`
Result []PrometheusResult `json:"result"`
} `json:"data"`
}
func QueryPrometheusMetrics ¶
type PrometheusResult ¶
Click to show internal directories.
Click to hide internal directories.