mirror of
https://github.com/kubevirt/containerized-data-importer.git
synced 2025-06-03 06:30:22 +00:00

* Refactor recording-rules and alerts code Signed-off-by: avlitman <alitman@redhat.com> * Remove promv1 from schema Signed-off-by: avlitman <alitman@redhat.com> --------- Signed-off-by: avlitman <alitman@redhat.com>
57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/machadovilaca/operator-observability/pkg/docs"
|
|
|
|
cdiMetrics "kubevirt.io/containerized-data-importer/pkg/monitoring/metrics/cdi-controller"
|
|
operatorMetrics "kubevirt.io/containerized-data-importer/pkg/monitoring/metrics/operator-controller"
|
|
"kubevirt.io/containerized-data-importer/pkg/monitoring/rules"
|
|
)
|
|
|
|
const tpl = `# Containerized Data Importer metrics
|
|
{{- range . }}
|
|
|
|
{{ $deprecatedVersion := "" -}}
|
|
{{- with index .ExtraFields "DeprecatedVersion" -}}
|
|
{{- $deprecatedVersion = printf " in %s" . -}}
|
|
{{- end -}}
|
|
|
|
{{- $stabilityLevel := "" -}}
|
|
{{- if and (.ExtraFields.StabilityLevel) (ne .ExtraFields.StabilityLevel "STABLE") -}}
|
|
{{- $stabilityLevel = printf "[%s%s] " .ExtraFields.StabilityLevel $deprecatedVersion -}}
|
|
{{- end -}}
|
|
|
|
### {{ .Name }}
|
|
{{ print $stabilityLevel }}{{ .Help }}. Type: {{ .Type -}}.
|
|
|
|
{{- end }}
|
|
|
|
## Developing new metrics
|
|
|
|
All metrics documented here are auto-generated and reflect exactly what is being
|
|
exposed. After developing new metrics or changing old ones please regenerate
|
|
this document.
|
|
`
|
|
|
|
func main() {
|
|
err := operatorMetrics.SetupMetrics()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = cdiMetrics.SetupMetrics()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if err := rules.SetupRules("test"); err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
docsString := docs.BuildMetricsDocsWithCustomTemplate(operatorMetrics.ListMetrics(), rules.ListRecordingRules(), tpl)
|
|
|
|
fmt.Print(docsString)
|
|
}
|