Monitoring Linter is a Golang linter designed to ensure that in Kubernetes operator projects,
monitoring-related practices are implemented within the pkg/monitoring directory using operator-observability methods.
It verifies that all metrics, alerts and recording rules registrations are centralized in this directory.
The use of Prometheus registration methods is restricted across the entire project.
Installation
go install github.com/kubevirt/monitoring/monitoringlinter/cmd/monitoringlinter@latest
Usage
Once installed, you can run the Monitoring Linter against your Kubernetes operator project by using the following command:
monitoringlinter ./...
Linter Rules
The following Prometheus registration methods calls are restricted across all the project:
prometheus.Register()
prometheus.MustRegister()
The following operator-observability methods calls are allowed only within pkg/monitoring directory: