Skip to content

Commit

Permalink
Merge pull request #93 from sustainable-computing-io/newlines
Browse files Browse the repository at this point in the history
improve logging
  • Loading branch information
trent-s authored Apr 16, 2024
2 parents 4742d61 + 43b5fb0 commit 83f28c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

susqlLog.Info("SusQL configuration values at runtime")
susqlLog.Info("metricsAddr=" + metricsAddr))
susqlLog.Info("enableLeaderElection=" + strconv.FormatBool(enableLeaderElection))
susqlLog.Info("probeAddr=" + probeAddr)
susqlLog.Info("keplerPrometheusUrl=" + keplerPrometheusUrl)
susqlLog.Info("keplerMetricName=" + keplerMetricName)
susqlLog.Info("susqlPrometheusMetricsUrl=" + susqlPrometheusMetricsUrl)
susqlLog.Info("susqlPrometheusDatabaseUrl=" + susqlPrometheusDatabaseUrl)
susqlLog.Info("samplingRate=" + samplingRate)

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/prometheus_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *LabelGroupReconciler) GetMostRecentValue(susqlPrometheusQuery string) (
if err != nil {
r.Logger.V(0).Error(err, fmt.Sprintf("[GetMostRecentValue] Couldn't create HTTP client.\n")+
fmt.Sprintf("\tQuery: %s\n", susqlPrometheusQuery)+
fmt.Sprintf("\tSusQLPrometheusDatabaseUrl: %s", r.SusQLPrometheusDatabaseUrl))
fmt.Sprintf("\tSusQLPrometheusDatabaseUrl: %s\n", r.SusQLPrometheusDatabaseUrl))
os.Exit(1)
}

Expand All @@ -78,7 +78,7 @@ func (r *LabelGroupReconciler) GetMostRecentValue(susqlPrometheusQuery string) (
if err != nil {
r.Logger.V(0).Error(err, fmt.Sprintf("[GetMostRecentValue] Querying Prometheus didn't work.\n")+
fmt.Sprintf("\tQuery: %s\n", queryString)+
fmt.Sprintf("\tSusQLPrometheusDatabaseUrl: %s", r.SusQLPrometheusDatabaseUrl))
fmt.Sprintf("\tSusQLPrometheusDatabaseUrl: %s\n", r.SusQLPrometheusDatabaseUrl))
return 0.0, err
}

Expand All @@ -103,7 +103,7 @@ func (r *LabelGroupReconciler) GetMetricValuesForPodNames(metricName string, pod
if err != nil {
r.Logger.V(0).Error(err, "[GetMetricValuesForPodNames] Couldn't create an HTTP client.\n"+
fmt.Sprintf("\tmetricName: %s\n", metricName)+
fmt.Sprintf("\tKeplerPrometheusUrl: %s", r.KeplerPrometheusUrl))
fmt.Sprintf("\tKeplerPrometheusUrl: %s\n", r.KeplerPrometheusUrl))
os.Exit(1)
}

Expand All @@ -125,7 +125,7 @@ func (r *LabelGroupReconciler) GetMetricValuesForPodNames(metricName string, pod
r.Logger.V(0).Error(err, "[GetMetricValuesForPodNames] Querying Prometheus didn't work.\n"+
fmt.Sprintf("\tmetricName: %s\n", metricName)+
fmt.Sprintf("\tKeplerPrometheusUrl: %s\n", r.KeplerPrometheusUrl)+
fmt.Sprintf("\tqueryString: %s", queryString))
fmt.Sprintf("\tqueryString: %s\n", queryString))
return nil, err
}

Expand Down

0 comments on commit 83f28c2

Please sign in to comment.