From 0a2895db869b336c99c782c694df2267fc41e615 Mon Sep 17 00:00:00 2001 From: Renaud Gaubert Date: Fri, 1 May 2020 23:20:28 -0700 Subject: [PATCH] Add initialization logging Signed-off-by: Renaud Gaubert --- pkg/main.go | 3 +++ pkg/pipeline.go | 2 ++ pkg/server.go | 1 + 3 files changed, 6 insertions(+) diff --git a/pkg/main.go b/pkg/main.go index ea4c45e..c0d2bfc 100644 --- a/pkg/main.go +++ b/pkg/main.go @@ -84,6 +84,8 @@ func main() { func Run(c *cli.Context) error { restart: + + logrus.Info("Starting dcgm-exporter") config := contextToConfig(c) cleanup, err := dcgm.Init(dcgm.Embedded) @@ -91,6 +93,7 @@ func Run(c *cli.Context) error { if err != nil { logrus.Fatal(err) } + logrus.Info("DCGM successfully initialized!") ch := make(chan string, 10) pipeline, cleanup, err := NewMetricsPipeline(config) diff --git a/pkg/pipeline.go b/pkg/pipeline.go index cfd3924..bce5a7a 100644 --- a/pkg/pipeline.go +++ b/pkg/pipeline.go @@ -82,6 +82,8 @@ func NewMetricsPipelineWithGPUCollector(c *Config, collector *DCGMCollector) (*M func (m *MetricsPipeline) Run(out chan string, stop chan interface{}, wg *sync.WaitGroup) { defer wg.Done() + logrus.Info("Pipeline starting") + // Note we are using a ticker so that we can stick as close as possible to the collect interval. // e.g: The CollectInterval is 10s and the transformation pipeline takes 5s, the time will // ensure we really collect metrics every 10s by firing an event 5s after the run function completes. diff --git a/pkg/server.go b/pkg/server.go index ad45452..cff9a36 100644 --- a/pkg/server.go +++ b/pkg/server.go @@ -53,6 +53,7 @@ func (s *MetricsServer) Run(stop chan interface{}, wg *sync.WaitGroup) { httpwg.Add(1) go func() { defer httpwg.Done() + logrus.Info("Starting webserver") if err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed { logrus.Fatalf("Failed to Listen and Server HTTP server with err: `%v`", err) }