Skip to content

Commit 9416e35

Browse files
authored
remove telemetry code in Windows CSE (#318)
1 parent 9c1e85f commit 9416e35

File tree

5 files changed

+0
-156
lines changed

5 files changed

+0
-156
lines changed

parts/k8s/kuberneteswindowsfunctions.ps1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,12 @@ function DownloadFileOverHttp {
4242
$oldProgressPreference = $ProgressPreference
4343
$ProgressPreference = 'SilentlyContinue'
4444

45-
$downloadTimer = [System.Diagnostics.Stopwatch]::StartNew()
4645
try {
4746
$args = @{Uri=$Url; Method="Get"; OutFile=$DestinationPath}
4847
Retry-Command -Command "Invoke-RestMethod" -Args $args -Retries 5 -RetryDelaySeconds 10
4948
} catch {
5049
throw "Fail in downloading $Url. Error: $_"
5150
}
52-
$downloadTimer.Stop()
53-
54-
if ($global:AppInsightsClient -ne $null) {
55-
$event = New-Object "Microsoft.ApplicationInsights.DataContracts.EventTelemetry"
56-
$event.Name = "FileDownload"
57-
$event.Properties["FileName"] = $fileName
58-
$event.Metrics["DurationMs"] = $downloadTimer.ElapsedMilliseconds
59-
$global:AppInsightsClient.TrackEvent($event)
60-
}
6151

6252
$ProgressPreference = $oldProgressPreference
6353
Write-Log "Downloaded file to $DestinationPath"

parts/k8s/kuberneteswindowssetup.ps1

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ $global:NetworkPlugin = "{{WrapAsParameter "networkPlugin"}}"
135135
$global:VNetCNIPluginsURL = "{{WrapAsParameter "vnetCniWindowsPluginsURL"}}"
136136
$global:IsDualStackEnabled = {{if IsIPv6DualStackFeatureEnabled}}$true{{else}}$false{{end}}
137137

138-
# Telemetry settings
139-
$global:EnableTelemetry = "{{WrapAsVariable "enableTelemetry" }}";
140-
$global:TelemetryKey = "{{WrapAsVariable "applicationInsightsKey" }}";
141-
142138
# CSI Proxy settings
143139
$global:EnableCsiProxy = [System.Convert]::ToBoolean("{{WrapAsVariable "windowsEnableCSIProxy" }}");
144140
$global:CsiProxyUrl = "{{WrapAsVariable "windowsCSIProxyURL" }}";
@@ -185,67 +181,19 @@ try
185181
Write-Log ".\CustomDataSetupScript.ps1 -MasterIP $MasterIP -KubeDnsServiceIp $KubeDnsServiceIp -MasterFQDNPrefix $MasterFQDNPrefix -Location $Location -AgentKey $AgentKey -AADClientId $AADClientId -AADClientSecret $AADClientSecret -NetworkAPIVersion $NetworkAPIVersion -TargetEnvironment $TargetEnvironment"
186182
Write-Log "Provisioning $global:DockerServiceName... with IP $MasterIP"
187183

188-
$global:globalTimer = [System.Diagnostics.Stopwatch]::StartNew()
189-
190-
$configAppInsightsClientTimer = [System.Diagnostics.Stopwatch]::StartNew()
191-
# Get app insights binaries and set up app insights client
192-
mkdir c:\k\appinsights
193-
DownloadFileOverHttp -Url "https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg" -DestinationPath "c:\k\appinsights\microsoft.applicationinsights.2.11.0.zip"
194-
Expand-Archive -Path "c:\k\appinsights\microsoft.applicationinsights.2.11.0.zip" -DestinationPath "c:\k\appinsights"
195-
$appInsightsDll = "c:\k\appinsights\lib\net46\Microsoft.ApplicationInsights.dll"
196-
[Reflection.Assembly]::LoadFile($appInsightsDll)
197-
$conf = New-Object "Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration"
198-
$conf.DisableTelemetry = -not $global:enableTelemetry
199-
$conf.InstrumentationKey = $global:TelemetryKey
200-
$global:AppInsightsClient = New-Object "Microsoft.ApplicationInsights.TelemetryClient"($conf)
201-
202-
$global:AppInsightsClient.Context.Properties["correlation_id"] = New-Guid
203-
$global:AppInsightsClient.Context.Properties["cri"] = $global:ContainerRuntime
204-
# TODO: Update once containerd versioning story is decided
205-
$global:AppInsightsClient.Context.Properties["cri_version"] = if ($global:ContainerRuntime -eq "docker") { $global:DockerVersion } else { "" }
206-
$global:AppInsightsClient.Context.Properties["k8s_version"] = $global:KubeBinariesVersion
207-
$global:AppInsightsClient.Context.Properties["lb_sku"] = $global:LoadBalancerSku
208-
$global:AppInsightsClient.Context.Properties["location"] = $Location
209-
$global:AppInsightsClient.Context.Properties["os_type"] = "windows"
210-
$global:AppInsightsClient.Context.Properties["os_version"] = Get-WindowsVersion
211-
$global:AppInsightsClient.Context.Properties["network_plugin"] = $global:NetworkPlugin
212-
$global:AppInsightsClient.Context.Properties["network_plugin_version"] = Get-CniVersion
213-
$global:AppInsightsClient.Context.Properties["network_mode"] = $global:NetworkMode
214-
$global:AppInsightsClient.Context.Properties["subscription_id"] = $global:SubscriptionId
215-
216-
$vhdId = ""
217-
if (Test-Path "c:\vhd-id.txt") {
218-
$vhdId = Get-Content "c:\vhd-id.txt"
219-
}
220-
$global:AppInsightsClient.Context.Properties["vhd_id"] = $vhdId
221-
222-
$imdsProperties = Get-InstanceMetadataServiceTelemetry
223-
foreach ($key in $imdsProperties.keys) {
224-
$global:AppInsightsClient.Context.Properties[$key] = $imdsProperties[$key]
225-
}
226-
227-
$configAppInsightsClientTimer.Stop()
228-
$global:AppInsightsClient.TrackMetric("Config-AppInsightsClient", $configAppInsightsClientTimer.Elapsed.TotalSeconds)
229-
230184
# Install OpenSSH if SSH enabled
231185
$sshEnabled = [System.Convert]::ToBoolean("{{ WindowsSSHEnabled }}")
232186

233187
if ( $sshEnabled ) {
234188
Write-Log "Install OpenSSH"
235-
$installOpenSSHTimer = [System.Diagnostics.Stopwatch]::StartNew()
236189
Install-OpenSSH -SSHKeys $SSHKeys
237-
$installOpenSSHTimer.Stop()
238-
$global:AppInsightsClient.TrackMetric("Install-OpenSSH", $installOpenSSHTimer.Elapsed.TotalSeconds)
239190
}
240191

241192
Write-Log "Apply telemetry data setting"
242193
Set-TelemetrySetting -WindowsTelemetryGUID $global:WindowsTelemetryGUID
243194

244195
Write-Log "Resize os drive if possible"
245-
$resizeTimer = [System.Diagnostics.Stopwatch]::StartNew()
246196
Resize-OSDrive
247-
$resizeTimer.Stop()
248-
$global:AppInsightsClient.TrackMetric("Resize-OSDrive", $resizeTimer.Elapsed.TotalSeconds)
249197

250198
Write-Log "Initialize data disks"
251199
Initialize-DataDisks
@@ -277,16 +225,13 @@ try
277225
}
278226

279227
Write-Log "Installing ContainerD"
280-
$containerdTimer = [System.Diagnostics.Stopwatch]::StartNew()
281228
$cniBinPath = $global:AzureCNIBinDir
282229
$cniConfigPath = $global:AzureCNIConfDir
283230
if ($global:NetworkPlugin -eq "kubenet") {
284231
$cniBinPath = $global:CNIPath
285232
$cniConfigPath = $global:CNIConfigPath
286233
}
287234
Install-Containerd -ContainerdUrl $global:ContainerdUrl -CNIBinDir $cniBinPath -CNIConfDir $cniConfigPath -KubeDir $global:KubeDir
288-
$containerdTimer.Stop()
289-
$global:AppInsightsClient.TrackMetric("Install-ContainerD", $containerdTimer.Elapsed.TotalSeconds)
290235

291236
Write-Log "Write Azure cloud provider config"
292237
Write-AzureConfig `
@@ -339,10 +284,7 @@ try
339284
}
340285

341286
Write-Log "Create the Pause Container kubletwin/pause"
342-
$infraContainerTimer = [System.Diagnostics.Stopwatch]::StartNew()
343287
New-InfraContainer -KubeDir $global:KubeDir
344-
$infraContainerTimer.Stop()
345-
$global:AppInsightsClient.TrackMetric("New-InfraContainer", $infraContainerTimer.Elapsed.TotalSeconds)
346288

347289
if (-not (Test-ContainerImageExists -Image "kubletwin/pause")) {
348290
Write-Log "Could not find container with name kubletwin/pause"
@@ -481,10 +423,6 @@ try
481423
Remove-Item $CacheDir -Recurse -Force
482424
}
483425

484-
$global:globalTimer.Stop()
485-
$global:AppInsightsClient.TrackMetric("TotalDuration", $global:globalTimer.Elapsed.TotalSeconds)
486-
$global:AppInsightsClient.Flush()
487-
488426
Write-Log "Setup Complete, reboot computer"
489427
Restart-Computer
490428
}
@@ -496,11 +434,6 @@ try
496434
}
497435
catch
498436
{
499-
$exceptionTelemtry = New-Object "Microsoft.ApplicationInsights.DataContracts.ExceptionTelemetry"
500-
$exceptionTelemtry.Exception = $_.Exception
501-
$global:AppInsightsClient.TrackException($exceptionTelemtry)
502-
$global:AppInsightsClient.Flush()
503-
504437
Write-Error $_
505438
throw $_
506439
}

pkg/engine/templates_generated.go

Lines changed: 0 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vhd/packer/configure-windows-vhd-phase2.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ function Get-FilesToCacheOnVHD {
6868
"https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/debug/VFP.psm1",
6969
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/helper.psm1",
7070
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/hns.v2.psm1"
71-
"https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg"
7271
);
7372
"c:\akse-cache\containerd\" = @(
7473
$global:containerdPackageUrl

vhd/packer/configure-windows-vhd.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ function Get-FilesToCacheOnVHD {
107107
"https://github.com/Microsoft/SDN/raw/master/Kubernetes/windows/debug/VFP.psm1",
108108
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/helper.psm1",
109109
"https://github.com/microsoft/SDN/raw/master/Kubernetes/windows/hns.v2.psm1"
110-
"https://globalcdn.nuget.org/packages/microsoft.applicationinsights.2.11.0.nupkg"
111110
);
112111
"c:\akse-cache\containerd\" = @(
113112
$global:containerdPackageUrl

0 commit comments

Comments
 (0)