• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubevirt / hyperconverged-cluster-operator / 11575589529

29 Oct 2024 02:03PM UTC coverage: 72.47% (-0.02%) from 72.494%
11575589529

Pull #3153

github

machadovilaca
Upgrade operator-observability package and remove deprecated functions

Signed-off-by: João Vilaça <machadovilaca@gmail.com>
Pull Request #3153: Upgrade operator-observability package and remove deprecated functions

8 of 9 new or added lines in 3 files covered. (88.89%)

3 existing lines in 1 file now uncovered.

6044 of 8340 relevant lines covered (72.47%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.86
/pkg/monitoring/rules/rules.go
1
package rules
2

3
import (
4
        "github.com/machadovilaca/operator-observability/pkg/operatorrules"
5
        promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
6
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7

8
        "github.com/kubevirt/hyperconverged-cluster-operator/pkg/monitoring/rules/alerts"
9
        "github.com/kubevirt/hyperconverged-cluster-operator/pkg/monitoring/rules/recordingrules"
10
        hcoutil "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util"
11
)
12

13
const (
14
        ruleName = hcoutil.HyperConvergedName + "-prometheus-rule"
15
)
16

17
var operatorRegistry = operatorrules.NewRegistry()
18

19
func SetupRules() error {
1✔
20
        err := recordingrules.Register(operatorRegistry)
1✔
21
        if err != nil {
1✔
22
                return err
×
23
        }
×
24

25
        err = alerts.Register(operatorRegistry)
1✔
26
        if err != nil {
1✔
27
                return err
×
28
        }
×
29

30
        return nil
1✔
31
}
32

33
func BuildPrometheusRule(namespace string, owner metav1.OwnerReference) (*promv1.PrometheusRule, error) {
×
NEW
34
        rules, err := operatorRegistry.BuildPrometheusRule(
×
35
                ruleName,
×
36
                namespace,
×
37
                hcoutil.GetLabels(hcoutil.HyperConvergedName, hcoutil.AppComponentMonitoring),
×
38
        )
×
39
        if err != nil {
×
40
                return nil, err
×
41
        }
×
42

43
        rules.OwnerReferences = []metav1.OwnerReference{owner}
×
44

×
45
        return rules, nil
×
46
}
47

48
func ListRecordingRules() []operatorrules.RecordingRule {
1✔
49
        return operatorRegistry.ListRecordingRules()
1✔
50
}
1✔
51

52
func ListAlerts() []promv1.Rule {
1✔
53
        return operatorRegistry.ListAlerts()
1✔
54
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc