Skip to content

Commit 4cbba77

Browse files
committed
add finished rule log message
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 8ded59d commit 4cbba77

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

kube_janitor/task.common.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log/slog"
7+
"time"
78

89
"github.com/prometheus/client_golang/prometheus"
910
"github.com/webdevops/go-common/log/slogger"
@@ -19,6 +20,7 @@ const (
1920

2021
// runRule executes one ConfigRule ttl run
2122
func (j *Janitor) runRule(ctx context.Context, logger *slogger.Logger, rule *ConfigRule, metricList *prometheusCommon.MetricList, filterFunc func(rule *ConfigRule, resource unstructured.Unstructured) (string, bool)) error {
23+
startTime := time.Now()
2224
ruleLogger := logger.With(
2325
slog.Any("rule", rule),
2426
)
@@ -87,6 +89,8 @@ func (j *Janitor) runRule(ctx context.Context, logger *slogger.Logger, rule *Con
8789
}
8890
}
8991

92+
logger.Info("finished rule", slog.Duration("duration", time.Since(startTime)))
93+
9094
return nil
9195
}
9296

0 commit comments

Comments
 (0)