Skip to content
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
8 changes: 1 addition & 7 deletions telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error {
if tb != nil && tb.Connected {
report, err = reportMgr.ReportToBytes()
if err == nil {
// If write fails, try to re-establish connections as server/client
if _, err = tb.Write(report); err != nil {
log.Printf("telemetry write failed:%v", err)
tb.Cancel()
}
}
}
Expand All @@ -124,7 +122,6 @@ func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error {

// ReportToBytes - returns the report bytes
func (reportMgr *ReportManager) ReportToBytes() ([]byte, error) {

switch reportMgr.Report.(type) {
case *CNIReport:
case *AIMetric:
Expand All @@ -145,9 +142,8 @@ func SendCNIMetric(cniMetric *AIMetric, tb *TelemetryBuffer) error {
reportMgr := &ReportManager{Report: cniMetric}
report, err = reportMgr.ReportToBytes()
if err == nil {
// If write fails, try to re-establish connections as server/client
if _, err = tb.Write(report); err != nil {
tb.Cancel()
log.Printf("Error writing to telemetry socket:%v", err)
}
}
}
Expand All @@ -160,10 +156,8 @@ func SendCNIEvent(tb *TelemetryBuffer, report *CNIReport) {
reportMgr := &ReportManager{Report: report}
reportBytes, err := reportMgr.ReportToBytes()
if err == nil {
// If write fails, try to re-establish connections as server/client
if _, err = tb.Write(reportBytes); err != nil {
log.Printf("Error writing to telemetry socket:%v", err)
tb.Cancel()
}
}
}
Expand Down