Documentation ¶
Overview ¶
Package metrics work with monitor metrics.
There are some monitor reserved labels(tags): - cluster_name - cluster_type - component - field - host - host_ip - is_edge - metric_name - org_name - version
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PipelineCounterTotalAdd = func(p spec.Pipeline, value float64) { if disableMetrics { return } defer func() { if r := recover(); r != nil { pipelineErrorLog(p, "[alert] failed to do metric PipelineCounterTotalAdd, err: %v", r) } }() _, labelValues, _ := generatePipelineMetricLabels(p) pipelineCounterTotal.WithLabelValues(labelValues...).Add(value) pipelineDebugLog(p, "metric: PipelineCounterTotalAdd, value: %v, labelValues: %v", value, labelValues) }
PipelineCounterTotalAdd 某时间段内累计执行次数、成功次数、失败次数
View Source
var PipelineEndEvent = func(p spec.Pipeline) { if disableMetrics { return } defer func() { if r := recover(); r != nil { pipelineErrorLog(p, "[alert] failed to do event PipelineEndEvent, err: %v", r) } }() _, _, metricLabels := generatePipelineMetricLabels(p) if err := reportClient.Send([]*report.Metric{{ Name: "dice_pipeline", Timestamp: time.Now().UnixNano(), Tags: metricLabels, Fields: generatePipelineEventFields(p), }}); err != nil { pipelineErrorLog(p, "[alert] failed to push pipeline bulk event, err: %v", err) } pipelineDebugLog(p, "send pipeline end event success") }
PipelineEndEvent 终态时推送事件 带有 org_id 或 org_name 才能在多云管理里通过租户信息查询出来
View Source
var PipelineGaugeProcessingAdd = func(p spec.Pipeline, value float64) { if disableMetrics { return } defer func() { if r := recover(); r != nil { pipelineErrorLog(p, "[alert] failed to do metric PipelineGaugeProcessingAdd, err: %v", r) } }() _, labelValues, _ := generatePipelineMetricLabels(p) pipelineGaugeProcessing.WithLabelValues(labelValues...).Add(value) pipelineDebugLog(p, "metric: PipelineGaugeProcessingAdd, value: %v, labelValues: %v", value, labelValues) }
PipelineGaugeProcessingAdd 正在处理中的个数
View Source
var TaskCounterTotalAdd = func(task spec.PipelineTask, value float64) { if disableMetrics { return } defer func() { if r := recover(); r != nil { taskErrorLog(task, "[alert] failed to do metric TaskCounterTotalAdd, err: %v", r) } }() labelValues := []string{task.Status.String(), task.Extra.ClusterName, task.Type} taskCounterTotal.WithLabelValues(labelValues...).Add(value) taskDebugLog(task, "metric: TaskCounterTotalAdd, value: %v, labelValues: %v", value, labelValues) }
TaskCounterTotalAdd 某时间段内累计执行次数、成功次数、失败次数
View Source
var TaskEndEvent = func(task spec.PipelineTask, p *spec.Pipeline) { if disableMetrics { return } defer func() { if r := recover(); r != nil { taskErrorLog(task, "[alert] failed to do event TaskEndEvent, err: %v", r) } }() if err := reportClient.Send([]*report.Metric{{ Name: "dice_pipeline_task", Timestamp: time.Now().UnixNano(), Tags: generateActionEventTags(task, p), Fields: generateActionEventFields(task), }}); err != nil { taskErrorLog(task, "[alert] failed to push task bulk event, err: %v", err) } taskDebugLog(task, "send task end event success") }
TaskEndEvent 终态时推送事件
View Source
var TaskGaugeProcessingAdd = func(task spec.PipelineTask, value float64) { if disableMetrics { return } defer func() { if r := recover(); r != nil { taskErrorLog(task, "[alert] failed to do metric TaskGaugeProcessingAdd, err: %v", r) } }() labelValues := []string{task.Extra.ClusterName, task.Type} taskGaugeProcessing.WithLabelValues(labelValues...).Add(value) taskDebugLog(task, "metric: TaskGaugeProcessingAdd, value: %v, labelValues: %v", value, labelValues) }
TaskGaugeProcessingAdd 正在处理中的个数
Functions ¶
func Initialize ¶
func Initialize(client report.MetricReport)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.