monitor

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryCPUUsageRateQl = "" /* 159-byte string literal not displayed */
	QueryMEMUsageRateQl = "" /* 150-byte string literal not displayed */
	QueryMEMUsageQl     = "sum(container_memory_working_set_bytes{image!=\"\", pod=~\"%s\"}) by (pod)"
	QueryNetReceiveQl   = "sum(rate(container_network_receive_bytes_total{image!=\"\", pod=~\"%s\"}[1m])) by (pod)"
	QueryNetTransmitQl  = "sum(rate(container_network_transmit_bytes_total{image!=\"\", pod=~\"%s\"}[1m])) by (pod)"
	QueryDiskUsageQl    = "sum(container_fs_usage_bytes{image!=\"\", pod=~\"%s\"}) by (pod)"
	QueryDiskReadQl     = "sum(rate(container_fs_reads_bytes_total{image!=\"\", pod=~\"%s\"}[1m])) by (pod)"
	QueryDiskWriteQl    = "sum(rate(container_fs_writes_bytes_total{image!=\"\", pod=~\"%s\"}[1m])) by (pod)"
	QueryGpuUtilQl      = "sum(rate(container_accelerator_duty_cycle{image!=\"\", pod=~\"%s\"}[1m])) by (pod)"
	QueryGpuMemUtilQl   = "" /* 162-byte string literal not displayed */
	QueryGpuMemUsageQl  = "sum(container_accelerator_memory_used_bytes{image!=\"\", pod=~\"%s\"}) by (pod)"
)

Variables

View Source
var PrometheusClientAPI v1.API

Functions

func CollectMetrics

func CollectMetrics() []byte

func GetMetricValue

func GetMetricValue(col prometheus.Collector) float64

func Init

func Init()

func MemoryUsage

func MemoryUsage() (virt, rss uint64)

func MetricsFlags

func MetricsFlags() []cli.Flag

func NewClientAPI

func NewClientAPI(address string) error

func StartJobMetricsService

func StartJobMetricsService(port int) string

func UpdateBaseMetrics

func UpdateBaseMetrics()

Types

type JobCollector

type JobCollector struct {
	CpuUsageRate *prometheus.GaugeVec
	MemoryUsage  *prometheus.GaugeVec
}

func (*JobCollector) Collect

func (j *JobCollector) Collect(ch chan<- prometheus.Metric)

func (*JobCollector) CollectPodMetrics

func (j *JobCollector) CollectPodMetrics(metricName string) error

func (*JobCollector) Describe

func (j *JobCollector) Describe(ch chan<- *prometheus.Desc)

type KubernetesMetric

type KubernetesMetric struct {
	PrometheusClientAPI v1.API
}

func (*KubernetesMetric) GetJobAvgMetrics

func (km *KubernetesMetric) GetJobAvgMetrics(metricName, jobID string) (float64, error)

func (*KubernetesMetric) GetJobSequenceMetrics

func (km *KubernetesMetric) GetJobSequenceMetrics(metricName, jobID string, start, end, step int64) (model.Value, error)

type MetricInterface

type MetricInterface interface {
	GetJobAvgMetrics(metricName, jobID string) (float64, error)
	GetJobSequenceMetrics(metricName, jobID string, start, end, step int64) (model.Value, error)
}

func NewKubernetesMetric

func NewKubernetesMetric(clientAPI v1.API) MetricInterface

type Rusage

type Rusage struct {
	syscall.Rusage
}

func GetRusage

func GetRusage() *Rusage

GetRusage returns CPU usage of current process.

func (*Rusage) GetStime

func (ru *Rusage) GetStime() float64

GetStime returns the system time in seconds.

func (*Rusage) GetUtime

func (ru *Rusage) GetUtime() float64

GetUtime returns the user time in seconds.

Jump to

Keyboard shortcuts

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