@@ -135,10 +135,6 @@ $global:NetworkPlugin = "{{WrapAsParameter "networkPlugin"}}"
135135$global :VNetCNIPluginsURL  =  " {{WrapAsParameter " " }}" 
136136$global :IsDualStackEnabled  =  {{if  IsIPv6DualStackFeatureEnabled}}$true {{else }}$false {{end }}
137137
138- #  Telemetry settings
139- $global :EnableTelemetry  =  " {{WrapAsVariable " "  }}" 
140- $global :TelemetryKey  =  " {{WrapAsVariable " "  }}" 
141- 
142138#  CSI Proxy settings
143139$global :EnableCsiProxy  =  [System.Convert ]::ToBoolean(" {{WrapAsVariable " "  }}" 
144140$global :CsiProxyUrl  =  " {{WrapAsVariable " "  }}" 
@@ -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  ` 
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" 
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    }
496434}
497435catch 
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}
0 commit comments