@@ -15,7 +15,6 @@ import (
1515 "github.com/Azure/azure-container-networking/cni"
1616 "github.com/Azure/azure-container-networking/cni/api"
1717 "github.com/Azure/azure-container-networking/cni/log"
18- telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
1918 "github.com/Azure/azure-container-networking/cni/util"
2019 "github.com/Azure/azure-container-networking/cns"
2120 cnscli "github.com/Azure/azure-container-networking/cns/client"
@@ -30,6 +29,7 @@ import (
3029 "github.com/Azure/azure-container-networking/platform"
3130 nnscontracts "github.com/Azure/azure-container-networking/proto/nodenetworkservice/3.302.0.744"
3231 "github.com/Azure/azure-container-networking/store"
32+ "github.com/Azure/azure-container-networking/telemetry"
3333 cniSkel "github.com/containernetworking/cni/pkg/skel"
3434 cniTypes "github.com/containernetworking/cni/pkg/types"
3535 cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
@@ -39,8 +39,8 @@ import (
3939
4040// matches if the string fully consists of zero or more alphanumeric, dots, dashes, parentheses, spaces, or underscores
4141var (
42- allowedInput = regexp .MustCompile (`^[a-zA-Z0-9._\-\(\) ]*$` )
43- telemetry = telemetryclient . Telemetry
42+ allowedInput = regexp .MustCompile (`^[a-zA-Z0-9._\-\(\) ]*$` )
43+ telemetryClient = telemetry . Client
4444)
4545
4646const (
@@ -295,10 +295,10 @@ func (plugin *NetPlugin) getPodInfo(args string) (name, ns string, err error) {
295295}
296296
297297func (plugin * NetPlugin ) setCNIReportDetails (containerID , opType , msg string ) {
298- telemetry .Settings ().OperationType = opType
299- telemetry .Settings ().SubContext = containerID
300- telemetry .Settings ().EventMessage = msg
301- telemetry .Settings ().Version = plugin .Version
298+ telemetryClient .Settings ().OperationType = opType
299+ telemetryClient .Settings ().SubContext = containerID
300+ telemetryClient .Settings ().EventMessage = msg
301+ telemetryClient .Settings ().Version = plugin .Version
302302}
303303
304304func addNatIPV6SubnetInfo (nwCfg * cni.NetworkConfig ,
@@ -383,10 +383,10 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
383383 if err != nil {
384384 return err
385385 }
386- telemetry .Settings ().ContainerName = k8sPodName + ":" + k8sNamespace
386+ telemetryClient .Settings ().ContainerName = k8sPodName + ":" + k8sNamespace
387387
388388 plugin .setCNIReportDetails (args .ContainerID , CNI_ADD , "" )
389- telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing ADD command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v StdinData:%s}." ,
389+ telemetryClient .SendEvent (fmt .Sprintf ("[cni-net] Processing ADD command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v StdinData:%s}." ,
390390 args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
391391
392392 iptables .DisableIPTableLock = nwCfg .DisableIPTableLock
@@ -437,7 +437,7 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
437437 zap .Any ("IPs" , cniResult .IPs ),
438438 zap .Error (log .NewErrorWithoutStackTrace (err )))
439439
440- telemetry .SendEvent (fmt .Sprintf ("ADD command completed with [ipamAddResult]: %s [epInfos]: %s [error]: %v " , ipamAddResult .PrettyString (), network .FormatStructPointers (epInfos ), err ))
440+ telemetryClient .SendEvent (fmt .Sprintf ("ADD command completed with [ipamAddResult]: %s [epInfos]: %s [error]: %v " , ipamAddResult .PrettyString (), network .FormatStructPointers (epInfos ), err ))
441441 }()
442442
443443 ipamAddResult = IPAMAddResult {interfaceInfo : make (map [string ]network.InterfaceInfo )}
@@ -493,7 +493,7 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
493493 // triggered only in swift v1 multitenancy
494494 // dual nic multitenancy -> two interface infos
495495 // multitenancy (swift v1) -> one interface info
496- telemetry .Settings ().Context = "AzureCNIMultitenancy"
496+ telemetryClient .Settings ().Context = "AzureCNIMultitenancy"
497497 plugin .multitenancyClient .Init (cnsClient , AzureNetIOShim {})
498498
499499 // Temporary if block to determining whether we disable SNAT on host (for multi-tenant scenario only)
@@ -969,7 +969,7 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
969969 logger .Info ("DEL command completed" ,
970970 zap .String ("pod" , k8sPodName ),
971971 zap .Error (log .NewErrorWithoutStackTrace (err )))
972- telemetry .SendEvent (fmt .Sprintf ("DEL command completed: [released ip]: %+v [podname]: %s [namespace]: %s [error]: %v" , nwCfg .IPAM .Address , k8sPodName , k8sNamespace , err ))
972+ telemetryClient .SendEvent (fmt .Sprintf ("DEL command completed: [released ip]: %+v [podname]: %s [namespace]: %s [error]: %v" , nwCfg .IPAM .Address , k8sPodName , k8sNamespace , err ))
973973 }()
974974
975975 // Parse network configuration from stdin.
@@ -987,10 +987,10 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
987987 if k8sPodName , k8sNamespace , err = plugin .getPodInfo (args .Args ); err != nil {
988988 logger .Error ("Failed to get POD info" , zap .Error (err ))
989989 }
990- telemetry .Settings ().ContainerName = k8sPodName + ":" + k8sNamespace
990+ telemetryClient .Settings ().ContainerName = k8sPodName + ":" + k8sNamespace
991991
992992 plugin .setCNIReportDetails (args .ContainerID , CNI_DEL , "" )
993- telemetry .SendEvent (fmt .Sprintf ("[cni-net] Processing DEL command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v, StdinData:%s}." ,
993+ telemetryClient .SendEvent (fmt .Sprintf ("[cni-net] Processing DEL command with args {ContainerID:%v Netns:%v IfName:%v Args:%v Path:%v, StdinData:%s}." ,
994994 args .ContainerID , args .Netns , args .IfName , args .Args , args .Path , args .StdinData ))
995995
996996 iptables .DisableIPTableLock = nwCfg .DisableIPTableLock
@@ -1120,14 +1120,14 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
11201120 for _ , epInfo := range epInfos {
11211121 logger .Info ("Deleting endpoint" ,
11221122 zap .String ("endpointID" , epInfo .EndpointID ))
1123- telemetry .SendEvent ("Deleting endpoint: " + epInfo .EndpointID )
1123+ telemetryClient .SendEvent ("Deleting endpoint: " + epInfo .EndpointID )
11241124
11251125 if ! nwCfg .MultiTenancy && (epInfo .NICType == cns .InfraNIC || epInfo .NICType == "" ) {
11261126 // Delegated/secondary nic ips are statically allocated so we don't need to release
11271127 // Call into IPAM plugin to release the endpoint's addresses.
11281128 for i := range epInfo .IPAddresses {
11291129 logger .Info ("Release ip" , zap .String ("ip" , epInfo .IPAddresses [i ].IP .String ()))
1130- telemetry .SendEvent (fmt .Sprintf ("Release ip: %s container id: %s endpoint id: %s" , epInfo .IPAddresses [i ].IP .String (), args .ContainerID , epInfo .EndpointID ))
1130+ telemetryClient .SendEvent (fmt .Sprintf ("Release ip: %s container id: %s endpoint id: %s" , epInfo .IPAddresses [i ].IP .String (), args .ContainerID , epInfo .EndpointID ))
11311131 err = plugin .ipamInvoker .Delete (& epInfo .IPAddresses [i ], nwCfg , args , nwInfo .Options )
11321132 if err != nil {
11331133 return plugin .RetriableError (fmt .Errorf ("failed to release address: %w" , err ))
0 commit comments