Skip to content

Commit 5018a36

Browse files
jaer-tsunYongli Chen
authored andcommitted
Adding CniSucceeded flag to report whether CNI had been run successfully. (#122)
1 parent 5a2ece7 commit 5018a36

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cni/network/plugin/main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ func main() {
6060
Report: &telemetry.Report{},
6161
}
6262

63+
reportManager.GetReport(pluginName, config.Version)
64+
reportManager.Report.Context = "AzureCNI"
65+
6366
if !reportManager.Report.GetReportState() {
6467
log.Printf("GetReport state file didn't exist. Setting flag to true")
65-
reportManager.GetReport(pluginName, config.Version)
66-
reportManager.Report.Context = "AzureCNI"
6768

6869
err = reportManager.SendReport()
6970
if err != nil {
@@ -100,4 +101,13 @@ func main() {
100101
if err != nil {
101102
os.Exit(1)
102103
}
104+
105+
// Report CNI successfully finished execution.
106+
reportManager.Report.CniSucceeded = true
107+
err = reportManager.SendReport()
108+
if err != nil {
109+
log.Printf("SendReport failed due to %v", err)
110+
} else {
111+
markSendReport(reportManager)
112+
}
103113
}

telemetry/telemetry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (reportMgr *ReportManager) SendReport() error {
149149

150150
log.Printf("Going to send Telemetry report to hostnetagent %v", reportMgr.HostNetAgentURL)
151151

152-
log.Printf(`"Start Flag %v CniSucceeded %t Name %v Version %v ErrorMessage %v vnet %v
152+
log.Printf(`"Start Flag %t CniSucceeded %t Name %v Version %v ErrorMessage %v vnet %v
153153
Context %v SubContext %v"`, reportMgr.Report.StartFlag, reportMgr.Report.CniSucceeded, reportMgr.Report.Name,
154154
reportMgr.Report.Version, reportMgr.Report.ErrorMessage, reportMgr.Report.VnetAddressSpace,
155155
reportMgr.Report.Context, reportMgr.Report.SubContext)

0 commit comments

Comments
 (0)