Documentation
¶
Index ¶
- Constants
- Variables
- func GetAnnotationsFromRuntimeInfo(info interface{}) map[string]string
- func GetQueryLabelsFromPrometheus(query string) map[string]string
- func InitMetrics()
- func StartMetricsService(port int, queueFunc ListQueueFunc, jobFunc ListJobFunc) string
- type Info
- type JobMetricCollector
- type JobStatus
- type JobTimePoint
- type ListJobFunc
- type ListQueueFunc
- type QueueMetricCollector
- type Status
- type TimePoint
- type TimePointManager
- type Timestamps
Constants ¶
View Source
const ( MetricJobTime = "pf_metric_job_time" MetricQueueInfo = "pf_metric_queue_info" MetricJobGPUInfo = "pf_metric_job_gpu_info" )
View Source
const ( JobIDLabel = "jobID" GpuIdxLabel = "id" StatusLabel = "status" QueueIDLabel = "queueID" FinishedStatusLabel = "finishedStatus" QueueNameLabel = "queueName" UserNameLabel = "userName" ResourceLabel = "resource" TypeLabel = "type" BaiduGpuIndexLabel = "baidu_com_gpu_idx" )
View Source
const ( MinTimePoint = T1 MinStatus = StatusDBInserting MaxTimePoint = T8 MaxStatus = StatusRunning )
View Source
const ( MaxNum = 10000 Timeout = time.Hour ZeroDuration = time.Duration(0) )
View Source
const ( QueueTypeMaxResource = "maxResource" QueueTypeMinResource = "minResource" QueueTypeScalarResource = "scalarResource" )
View Source
const ( PromQLQueryPodAnnotations = "kube_pod_annotations{pod~=\"%s\"}" PromQLQueryPodLabels = "kube_pod_labels{pod~=\"%s\"}" )
View Source
const (
DefaultMetricPort = 8231
)
View Source
const (
QueryTimeout = time.Second * 1
)
Variables ¶
View Source
var (
ZeroTime = time.Time{}
)
Functions ¶
func GetAnnotationsFromRuntimeInfo ¶ added in v0.14.5
GetAnnotationsFromRuntimeInfo get annotations from info map
func GetQueryLabelsFromPrometheus ¶ added in v0.14.5
GetQueryLabelsFromPrometheus return query labels from prometheus Deprecated
func InitMetrics ¶
func InitMetrics()
func StartMetricsService ¶
func StartMetricsService(port int, queueFunc ListQueueFunc, jobFunc ListJobFunc) string
Types ¶
type JobMetricCollector ¶
type JobMetricCollector struct {
// contains filtered or unexported fields
}
func NewJobMetricsCollector ¶
func NewJobMetricsCollector(manager TimePointManager, listJob ListJobFunc) *JobMetricCollector
func (*JobMetricCollector) Collect ¶
func (j *JobMetricCollector) Collect(metrics chan<- prometheus.Metric)
func (*JobMetricCollector) Describe ¶
func (j *JobMetricCollector) Describe(descs chan<- *prometheus.Desc)
type JobTimePoint ¶
type JobTimePoint int
const ( // T1 api query time T1 JobTimePoint = iota // T2 db insert time T2 // T3 enqueue time T3 // T4 dequeue time T4 // T5 submit time T5 // T6 scheduled time // TODO: T6 is not supported yet T6 // T7 run time T7 // T8 finish(success/fail) time T8 )
func (JobTimePoint) Index ¶
func (t JobTimePoint) Index() int
func (JobTimePoint) Status ¶
func (t JobTimePoint) Status() Status
type ListJobFunc ¶ added in v0.14.5
type ListQueueFunc ¶
type QueueMetricCollector ¶
type QueueMetricCollector struct {
// contains filtered or unexported fields
}
func NewQueueMetricsCollector ¶
func NewQueueMetricsCollector(queueFunc ListQueueFunc) *QueueMetricCollector
func (*QueueMetricCollector) Collect ¶
func (q *QueueMetricCollector) Collect(metrics chan<- prometheus.Metric)
func (*QueueMetricCollector) Describe ¶
func (q *QueueMetricCollector) Describe(descs chan<- *prometheus.Desc)
type TimePointManager ¶
type TimePointManager interface { AddTimestamp(key string, timePoint TimePoint, timestamp time.Time, extraInfos ...Info) GetStatusTime(key string, status Status) (time.Duration, bool) GetTimestamp(key string, timePoint TimePoint) (time.Time, bool) GetTimestampsCache() map[string]Timestamps GetStatusCount(status Status) int64 GetInfo(key string) (Info, bool) }
var ( Job TimePointManager PromAPIClient prom_v1.API )
func NewJobMetricTimePointManager ¶
func NewJobMetricTimePointManager() TimePointManager
NewJobMetricTimePointManager Implementation of default job metric manager
Click to show internal directories.
Click to hide internal directories.