Skip to content

Commit

Permalink
Add prometheus logger to be able to debug discovery issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vape-spryker committed Dec 10, 2024
1 parent ee79427 commit 257e772
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/otel-allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ func main() {
httpOptions = append(httpOptions, server.WithTLSConfig(tlsConfig, cfg.HTTPS.ListenAddr))
}
srv := server.NewServer(log, allocator, cfg.ListenAddr, httpOptions...)

promLogger := gokitlog.With(gokitlog.NewJSONLogger(gokitlog.NewSyncWriter(os.Stdout)), "logger", "prometheus-discovery")
discoveryCtx, discoveryCancel := context.WithCancel(ctx)
sdMetrics, err := discovery.CreateAndRegisterSDMetrics(prometheus.DefaultRegisterer)
if err != nil {
setupLog.Error(err, "Unable to register metrics for Prometheus service discovery")
os.Exit(1)
}
discoveryManager = discovery.NewManager(discoveryCtx, gokitlog.NewNopLogger(), prometheus.DefaultRegisterer, sdMetrics)
discoveryManager = discovery.NewManager(discoveryCtx, promLogger, prometheus.DefaultRegisterer, sdMetrics)

targetDiscoverer = target.NewDiscoverer(log, discoveryManager, allocatorPrehook, srv)
collectorWatcherType, err := collector.ParseCollectorWatcherType(cfg.CollectorWatcher.WatcherType)
Expand Down

0 comments on commit 257e772

Please sign in to comment.