Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a few log messages to exporter process #367

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/exporter/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ func InitExportingProcess(input ExporterInput) (*ExportingProcess, error) {
case <-expProc.stopCh:
return
case <-ticker.C:
klog.V(2).Info("Sending refreshed templates to the collector")
err := expProc.sendRefreshedTemplates()
if err != nil {
klog.Errorf("Error when sending refreshed templates, closing the connection to the collector: %v", err)
expProc.closeConnToCollector()
return
}
klog.V(2).Info("Sent refreshed templates to the collector")
}
}
}()
Expand Down Expand Up @@ -278,11 +280,12 @@ func (ep *ExportingProcess) closeConnToCollector() {
if ep.isClosed.Swap(true) {
return
}
klog.Info("Closing connection to the collector")
close(ep.stopCh)
if err := ep.connToCollector.Close(); err != nil {
// Just log the error that happened when closing the connection. Not returning error
// as we do not expect library consumers to exit their programs with this error.
klog.Errorf("Error when closing connection to collector: %v", err)
klog.Errorf("Error when closing connection to the collector: %v", err)
}
}

Expand Down
Loading