Skip to content

Commit

Permalink
Merge pull request #35 from rfredette/ocpbugs-15253-ingress-alerts
Browse files Browse the repository at this point in the history
OCPBUGS-15253: Include ingress's namespace in ingress without class metric
  • Loading branch information
openshift-ci[bot] committed Oct 25, 2023
2 parents 03299cf + c5fdfff commit c5cc7a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/route/ingress/metrics.go
Expand Up @@ -23,7 +23,7 @@ var (
ingressesWithoutClassName = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: metricIngressWithoutClassName,
Help: "Report the number of ingresses that do not specify ingressClassName.",
}, []string{"name"})
}, []string{"name", "namespace"})
)

func (c *Controller) Create(v *semver.Version) bool {
Expand Down Expand Up @@ -69,7 +69,7 @@ func (c *Controller) Collect(ch chan<- prometheus.Metric) {
if icName == nil || *icName == "" {
labelVal = 1
}
ingressesWithoutClassName.WithLabelValues(ingressInstance.Name).Set(float64(labelVal))
ingressesWithoutClassName.WithLabelValues(ingressInstance.Name, ingressInstance.Namespace).Set(float64(labelVal))
}

ingressesWithoutClassName.Collect(ch)
Expand Down
8 changes: 4 additions & 4 deletions pkg/route/ingress/metrics_test.go
Expand Up @@ -58,7 +58,7 @@ func TestMetrics(t *testing.T) {
},
ingressclassLister: &ingressclassLister{},
routeLister: &routeLister{},
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"nil-ingressclassname\"} 1",
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"nil-ingressclassname\",namespace=\"test\"} 1",
},
{
name: "Ingress with empty IngressClassName should return 1",
Expand All @@ -75,7 +75,7 @@ func TestMetrics(t *testing.T) {
},
ingressclassLister: &ingressclassLister{},
routeLister: &routeLister{},
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"empty-ingressclassname\"} 1",
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"empty-ingressclassname\",namespace=\"test\"} 1",
},
{
name: "Ingress with empty string IngressClassName should return 1",
Expand All @@ -94,7 +94,7 @@ func TestMetrics(t *testing.T) {
},
ingressclassLister: &ingressclassLister{},
routeLister: &routeLister{},
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"emptystring-ingressclassname\"} 1",
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"emptystring-ingressclassname\",namespace=\"test\"} 1",
},
{
name: "Ingress with set IngressClassName should return 0",
Expand All @@ -113,7 +113,7 @@ func TestMetrics(t *testing.T) {
},
ingressclassLister: &ingressclassLister{},
routeLister: &routeLister{},
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"set-ingressclassname\"} 0",
expectedResponse: "openshift_ingress_to_route_controller_ingress_without_class_name{name=\"set-ingressclassname\",namespace=\"test\"} 0",
},
{
name: "Route with an unmanaged Ingress owner should return 1",
Expand Down

0 comments on commit c5cc7a7

Please sign in to comment.