Skip to content

Commit

Permalink
remove newly added telemetry events
Browse files Browse the repository at this point in the history
we will split this part of the pr into its own pr
a telemetry event was added back which was previously removed
undo this pr to add those telemetry statements back
  • Loading branch information
QxBytes committed Nov 15, 2024
1 parent 519c293 commit dd9ca83
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 18 deletions.
2 changes: 0 additions & 2 deletions cni/network/invoker_cns.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro
}
}

telemetry.SendEvent(fmt.Sprintf("Received from cns: %+v", response.PodIPInfo))

addResult := IPAMAddResult{interfaceInfo: make(map[string]network.InterfaceInfo)}
numInterfacesWithDefaultRoutes := 0

Expand Down
1 change: 0 additions & 1 deletion cni/network/multitenancy.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ func (m *Multitenancy) getNetworkContainersInternal(
}

logger.Info("Network config received from cns", zap.Any("nconfig", ncConfigs))
telemetry.SendEvent(fmt.Sprintf("Network config received from cns: %+v", ncConfigs))

subnetPrefixes := []net.IPNet{}
for i := 0; i < len(ncConfigs); i++ {
Expand Down
2 changes: 1 addition & 1 deletion cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
for _, epInfo := range epInfos {
logger.Info("Deleting endpoint",
zap.String("endpointID", epInfo.EndpointID))
telemetry.SendEvent("Deleting endpoint: " + epInfo.EndpointID)

if !nwCfg.MultiTenancy && (epInfo.NICType == cns.InfraNIC || epInfo.NICType == "") {
// Delegated/secondary nic ips are statically allocated so we don't need to release
Expand All @@ -1135,7 +1136,6 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
} else if epInfo.EnableInfraVnet { // remove in future PR
nwCfg.IPAM.Subnet = nwInfo.Subnets[0].Prefix.String()
nwCfg.IPAM.Address = epInfo.InfraVnetIP.IP.String()
telemetry.SendEvent(fmt.Sprintf("Deleting infra vnet endpoint: container id: %s endpoint id: %s subnet: %s address: %s", args.ContainerID, epInfo.EndpointID, nwCfg.IPAM.Subnet, nwCfg.IPAM.Address))
err = plugin.ipamInvoker.Delete(nil, nwCfg, args, nwInfo.Options)
if err != nil {
return plugin.RetriableError(fmt.Errorf("failed to release address: %w", err))
Expand Down
6 changes: 1 addition & 5 deletions network/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"

"github.com/Azure/azure-container-networking/cni/log"
telemetryclient "github.com/Azure/azure-container-networking/cni/telemetry/client"
"github.com/Azure/azure-container-networking/cns"
"github.com/Azure/azure-container-networking/netio"
"github.com/Azure/azure-container-networking/netlink"
Expand All @@ -24,10 +23,7 @@ const (
InfraVnet = 0
)

var (
logger = log.CNILogger.With(zap.String("component", "net"))
telemetry = telemetryclient.Telemetry
)
var logger = log.CNILogger.With(zap.String("component", "net"))

type AzureHNSEndpoint struct{}

Expand Down
2 changes: 0 additions & 2 deletions network/endpoint_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ func (nw *network) newEndpointImplHnsV2(cli apipaClient, epInfo *EndpointInfo) (

// Create the HCN endpoint.
logger.Info("Creating hcn endpoint", zap.Any("hcnEndpoint", hcnEndpoint), zap.String("computenetwork", hcnEndpoint.HostComputeNetwork))
telemetry.SendEvent(fmt.Sprintf("Creating HCN endpoint: %+v", hcnEndpoint))
hnsResponse, err := Hnsv2.CreateEndpoint(hcnEndpoint)
if err != nil {
return nil, fmt.Errorf("Failed to create endpoint: %s due to error: %v", hcnEndpoint.Name, err)
Expand Down Expand Up @@ -580,7 +579,6 @@ func (nw *network) deleteEndpointImplHnsV2(ep *endpoint) error {
}

logger.Info("Deleting hcn endpoint with id", zap.String("HnsId", ep.HnsId))
telemetry.SendEvent("Deleting HCN endpoint: " + ep.HnsId)

hcnEndpoint, err = Hnsv2.GetEndpointByID(ep.HnsId)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions network/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package network

import (
"context"
"fmt"
"net"
"sync"
"time"
Expand Down Expand Up @@ -431,7 +430,7 @@ func (nm *networkManager) UpdateEndpointState(eps []*endpoint) error {
}
// we assume all endpoints have the same container id
cnsEndpointID := eps[0].ContainerID
telemetry.SendEvent(fmt.Sprintf("Stateless CNI update endpoint state for %s with: %+v ", cnsEndpointID, ifNameToIPInfoCopy))

if err := validateUpdateEndpointState(cnsEndpointID, ifnameToIPInfoMap); err != nil {
return errors.Wrap(err, "failed to validate update endpoint state that will be sent to cns")
}
Expand Down
2 changes: 0 additions & 2 deletions network/network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ func (nm *networkManager) newNetworkImplHnsV2(nwInfo *EndpointInfo, extIf *exter
// if network not found, create the HNS network.
if errors.As(err, &hcn.NetworkNotFoundError{}) {
logger.Info("Creating hcn network", zap.Any("hcnNetwork", hcnNetwork))
telemetry.SendEvent(fmt.Sprintf("Creating HCN network: %+v", hcnNetwork))
hnsResponse, err = Hnsv2.CreateNetwork(hcnNetwork)
if err != nil {
return nil, fmt.Errorf("Failed to create hcn network: %s due to error: %v", hcnNetwork.Name, err)
Expand Down Expand Up @@ -476,7 +475,6 @@ func (nm *networkManager) deleteNetworkImplHnsV2(nw *network) error {
var hcnNetwork *hcn.HostComputeNetwork
var err error
logger.Info("Deleting hcn network with id", zap.String("id", nw.HnsId))
telemetry.SendEvent("Deleting HCN network: " + nw.HnsId)

if hcnNetwork, err = Hnsv2.GetNetworkByID(nw.HnsId); err != nil {
return fmt.Errorf("Failed to get hcn network with id: %s due to err: %v", nw.HnsId, err)
Expand Down
3 changes: 0 additions & 3 deletions network/transparent_vlan_endpointclient_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ func (client *TransparentVlanEndpointClient) ensureCleanPopulateVM() error {
if vlanIfErr != nil {
// Assume any error is the vlan interface not found
logger.Info("vlan interface doesn't exist even though network namespace exists, deleting network namespace...", zap.String("message", vlanIfErr.Error()))
telemetry.SendEvent(fmt.Sprintf("vlan interface %s doesn't exist even though network namespace exists, deleting", client.vlanIfName))
delErr := client.netnsClient.DeleteNamed(client.vnetNSName)
if delErr != nil {
return errors.Wrap(delErr, "failed to cleanup/delete ns after noticing vlan veth does not exist")
Expand All @@ -156,7 +155,6 @@ func (client *TransparentVlanEndpointClient) ensureCleanPopulateVM() error {
if vlanIfInVMErr == nil {
// The vlan interface exists in the VM ns because it failed to move into the network ns previously and needs to be cleaned up
logger.Info("vlan interface exists on the VM namespace, deleting", zap.String("vlanIfName", client.vlanIfName))
telemetry.SendEvent(fmt.Sprintf("vlan interface %s exists on the VM namespace, deleting", client.vlanIfName))
if delErr := client.netlink.DeleteLink(client.vlanIfName); delErr != nil {
return errors.Wrap(delErr, "failed to clean up vlan interface")
}
Expand Down Expand Up @@ -302,7 +300,6 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
return errors.Wrap(deleteNSIfNotNilErr, "failed to move or detect vlan veth inside vnet namespace")
}
logger.Info("Moving vlan veth into namespace confirmed")
telemetry.SendEvent(fmt.Sprintf("Moving vlan veth %s into namespace %s (id: %d) confirmed", client.vlanIfName, client.vnetNSName, client.vnetNSFileDescriptor))
} else {
logger.Info("Existing NS detected. vlan interface should exist or namespace would've been deleted.", zap.String("vnetNSName", client.vnetNSName), zap.String("vlanIfName", client.vlanIfName))
}
Expand Down

0 comments on commit dd9ca83

Please sign in to comment.