Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move clone_progress to separate list #2929

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/cdi-cloner/clone-source.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func startPrometheus() {
func createProgressReader(readCloser io.ReadCloser, ownerUID string, totalBytes uint64) io.ReadCloser {
progress := prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: monitoring.MetricOptsList[monitoring.CloneProgress].Name,
avlitman marked this conversation as resolved.
Show resolved Hide resolved
Help: monitoring.MetricOptsList[monitoring.CloneProgress].Help,
Name: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Name,
Help: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Help,
},
[]string{"ownerUID"},
)
Expand Down
2 changes: 0 additions & 2 deletions doc/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ This document aims to help users that are not familiar with metrics exposed by t
All metrics documented here are auto-generated by the utility tool `tools/metricsdocs` and reflects exactly what is being exposed.

## Containerized Data Importer Metrics List
### clone_progress
The clone progress in percentage. Type: Counter.
### kubevirt_cdi_clone_pods_high_restart
The number of CDI clone pods with high restart count. Type: Gauge.
### kubevirt_cdi_cr_ready
Expand Down
4 changes: 2 additions & 2 deletions pkg/image/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ var (

progress = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: monitoring.MetricOptsList[monitoring.CloneProgress].Name,
Help: monitoring.MetricOptsList[monitoring.CloneProgress].Help,
Name: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Name,
Help: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Help,
},
[]string{"ownerUID"},
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/importer/format-readers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
var (
progress = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: monitoring.MetricOptsList[monitoring.CloneProgress].Name,
Help: monitoring.MetricOptsList[monitoring.CloneProgress].Help,
Name: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Name,
Help: monitoring.InternalMetricOptsList[monitoring.CloneProgress].Help,
},
[]string{"ownerUID"},
)
Expand Down
14 changes: 9 additions & 5 deletions pkg/monitoring/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ const (

// MetricOptsList list all CDI metrics
var MetricOptsList = map[MetricsKey]MetricOpts{
CloneProgress: {
Name: "clone_progress",
Help: "The clone progress in percentage",
Type: "Counter",
},
DataImportCronOutdated: {
Name: "kubevirt_cdi_dataimportcron_outdated",
Help: "DataImportCron has an outdated import",
Expand All @@ -55,6 +50,15 @@ var MetricOptsList = map[MetricsKey]MetricOpts{
},
}

// InternalMetricOptsList list all CDI metrics used for internal purposes only
var InternalMetricOptsList = map[MetricsKey]MetricOpts{
CloneProgress: {
Name: "clone_progress",
Help: "The clone progress in percentage",
Type: "Counter",
},
}

// GetRecordRulesDesc returns CDI Prometheus Record Rules
func GetRecordRulesDesc(namespace string) []RecordRulesDesc {
return []RecordRulesDesc{
Expand Down
6 changes: 2 additions & 4 deletions tools/prom-metrics-collector/metrics_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ import (

// This should be used only for very rare cases where the naming conventions that are explained in the best practices:
// https://sdk.operatorframework.io/docs/best-practices/observability-best-practices/#metrics-guidelines
// should be ignored, open issue: https://github.com/kubevirt/containerized-data-importer/issues/2515.
var excludedMetrics = map[string]struct{}{
"clone_progress": {},
}
// should be ignored.
var excludedMetrics = map[string]struct{}{}

func recordRulesDescToMetricList(mdl []monitoring.RecordRulesDesc) []monitoring.MetricOpts {
res := make([]monitoring.MetricOpts, len(mdl))
Expand Down