Skip to content

Commit aed1911

Browse files
committed
debug: log
1 parent 11fed91 commit aed1911

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/metrics/collector.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package metrics
22

33
import (
44
"context"
5+
"encoding/json"
6+
"fmt"
57
"regexp"
68
"strings"
79

@@ -12,6 +14,7 @@ import (
1214
"k8s.io/apimachinery/pkg/api/meta"
1315
kstatus "sigs.k8s.io/cli-utils/pkg/kstatus/status"
1416
"sigs.k8s.io/controller-runtime/pkg/client"
17+
logf "sigs.k8s.io/controller-runtime/pkg/log"
1518
"sigs.k8s.io/controller-runtime/pkg/manager"
1619
k8smetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
1720

@@ -153,6 +156,8 @@ func (c ImageMetricsCollector) Collect(metrics chan<- prometheus.Metric) {
153156
issuesLabelValues := make([]string, len(cisLabelValues)+1)
154157
patchStatusLabelValues := make([]string, len(cisLabelValues)+1)
155158

159+
logf.FromContext(ctx).Info("ImageMetricsCollector", "len", string(len(cisList.Items)))
160+
156161
for _, cis := range cisList.Items {
157162
for i, l := range c.cisLabels {
158163
cisLabelValues[i] = l.value(cis)
@@ -192,9 +197,12 @@ func (c ImageMetricsCollector) Collect(metrics chan<- prometheus.Metric) {
192197
}
193198
}
194199

200+
d, _ := json.Marshal(severities)
201+
logf.FromContext(ctx).Info("IssuesSeverities", "issues", string(d))
195202
for severity, count := range severities {
196203
issuesLabelValues[len(issuesLabelValues)-1] = severity
197204
metrics <- prometheus.MustNewConstMetric(c.issuesDesc, prometheus.GaugeValue, float64(count), issuesLabelValues...)
205+
logf.FromContext(ctx).Info("Issues", "issues", fmt.Sprintf("%v", count))
198206
}
199207

200208
for patchStatus, count := range patchStatuses {

0 commit comments

Comments
 (0)