@@ -294,12 +294,10 @@ func (plugin *NetPlugin) getPodInfo(args string) (name, ns string, err error) {
294294 return k8sPodName , k8sNamespace , nil
295295}
296296
297- func (plugin * NetPlugin ) setCNIReportDetails (nwCfg * cni. NetworkConfig , opType , msg string ) {
297+ func (plugin * NetPlugin ) setCNIReportDetails (containerID string , opType , msg string ) {
298298 telemetry .CNIReportSettings .OperationType = opType
299- telemetry .CNIReportSettings .SubContext = fmt . Sprintf ( "%+v" , nwCfg )
299+ telemetry .CNIReportSettings .SubContext = containerID
300300 telemetry .CNIReportSettings .EventMessage = msg
301- telemetry .CNIReportSettings .BridgeDetails .NetworkMode = nwCfg .Mode
302- telemetry .CNIReportSettings .InterfaceDetails .SecondaryCAUsedCount = plugin .nm .GetNumberOfEndpoints ("" , nwCfg .Name )
303301 telemetry .CNIReportSettings .Version = plugin .Version
304302}
305303
@@ -367,8 +365,6 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
367365 zap .Any ("args" , args .Args ),
368366 zap .String ("path" , args .Path ),
369367 zap .ByteString ("stdinData" , args .StdinData ))
370- telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing ADD command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v StdinData:%s}." ,
371- args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
372368
373369 // Parse network configuration from stdin.
374370 nwCfg , err := cni .ParseNetworkConfig (args .StdinData )
@@ -382,8 +378,11 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
382378 return err
383379 }
384380
381+ plugin .setCNIReportDetails (args .ContainerID , CNI_ADD , "" )
382+ telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing ADD command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v StdinData:%s}." ,
383+ args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
384+
385385 iptables .DisableIPTableLock = nwCfg .DisableIPTableLock
386- plugin .setCNIReportDetails (nwCfg , CNI_ADD , "" )
387386
388387 defer func () {
389388 // Add Interfaces to result.
@@ -966,8 +965,6 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
966965 zap .Any ("args" , args .Args ),
967966 zap .String ("path" , args .Path ),
968967 zap .ByteString ("stdinData" , args .StdinData ))
969- telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing DEL command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v, StdinData:%s}." ,
970- args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
971968
972969 defer func () {
973970 logger .Info ("DEL command completed" ,
@@ -992,8 +989,10 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
992989 logger .Error ("Failed to get POD info" , zap .Error (err ))
993990 }
994991
995- plugin .setCNIReportDetails (nwCfg , CNI_DEL , "" )
992+ plugin .setCNIReportDetails (args . ContainerID , CNI_DEL , "" )
996993 telemetry .CNIReportSettings .ContainerName = k8sPodName + ":" + k8sNamespace
994+ telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing DEL command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v, StdinData:%s}." ,
995+ args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
997996
998997 iptables .DisableIPTableLock = nwCfg .DisableIPTableLock
999998
@@ -1186,7 +1185,7 @@ func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error {
11861185 logger .Info ("Read network configuration" , zap .Any ("config" , nwCfg ))
11871186
11881187 iptables .DisableIPTableLock = nwCfg .DisableIPTableLock
1189- plugin .setCNIReportDetails (nwCfg , CNI_UPDATE , "" )
1188+ plugin .setCNIReportDetails (args . ContainerID , CNI_UPDATE , "" )
11901189
11911190 defer func () {
11921191 if result == nil {
@@ -1335,7 +1334,7 @@ func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error {
13351334 }
13361335
13371336 msg := fmt .Sprintf ("CNI UPDATE succeeded : Updated %+v podname %v namespace %v" , targetNetworkConfig , k8sPodName , k8sNamespace )
1338- plugin .setCNIReportDetails (nwCfg , CNI_UPDATE , msg )
1337+ plugin .setCNIReportDetails (args . ContainerID , CNI_UPDATE , msg )
13391338
13401339 return nil
13411340}
0 commit comments