Fixed incorrect app insights telemetry key (#26)

* Fixed incorrect app insights telemetry key

* Fixed telemetry Name property to match Az standard

* Schema adjustments to match Az telemetry

Co-authored-by: Dingmeng Xue <dixue@microsoft.com>
This commit is contained in:
Keith Babinec 2020-08-20 18:25:08 -07:00 коммит произвёл GitHub
Родитель 582be6f99c
Коммит 3d1d9fec92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -2,7 +2,7 @@ class Constants
{ {
static [System.String] $ConfigurationDirectoryName = ".aztoolsmigration" static [System.String] $ConfigurationDirectoryName = ".aztoolsmigration"
static [System.String] $ConfigurationFileName = "module-preferences.json" static [System.String] $ConfigurationFileName = "module-preferences.json"
static [System.String] $PublicTelemetryInstrumentationKey = "f1e252c1-5cb5-4ddb-8a2a-66e6a16d1c71" static [System.String] $PublicTelemetryInstrumentationKey = "7df6ff70-8353-4672-80d6-568517fed090"
static [System.String] $PublicTelemetryIngestionEndpointUri = "https://dc.services.visualstudio.com/v2/track" static [System.String] $PublicTelemetryIngestionEndpointUri = "https://dc.services.visualstudio.com/v2/track"
} }

Просмотреть файл

@ -60,8 +60,10 @@ function Send-PageViewTelemetry
# prepare the REST request body schema (version 2.x). # prepare the REST request body schema (version 2.x).
$InstrumentationKeyNoDashes = $InstrumentationKey.Replace('-','')
$bodyObject = [PSCustomObject]@{ $bodyObject = [PSCustomObject]@{
'name' = "AppPageViews" 'name' = "Microsoft.ApplicationInsights.$InstrumentationKeyNoDashes.PageView"
'time' = ([System.DateTime]::UtcNow.ToString('o')) 'time' = ([System.DateTime]::UtcNow.ToString('o'))
'iKey' = $InstrumentationKey 'iKey' = $InstrumentationKey
'tags' = [PSCustomObject]@{ 'tags' = [PSCustomObject]@{
@ -70,7 +72,7 @@ function Send-PageViewTelemetry
'data' = [PSCustomObject]@{ 'data' = [PSCustomObject]@{
'baseType' = 'PageViewData' 'baseType' = 'PageViewData'
'baseData' = [PSCustomObject]@{ 'baseData' = [PSCustomObject]@{
'ver' = '2' 'ver' = 2
'name' = $PageName 'name' = $PageName
'duration' = $Duration.ToString() 'duration' = $Duration.ToString()
'properties' = $customPropertiesObj 'properties' = $customPropertiesObj
@ -89,4 +91,4 @@ function Send-PageViewTelemetry
$null = Invoke-RestMethod -Uri $AppInsightsIngestionEndpoint -Method Post -Headers $headers -Body $bodyAsCompressedJson $null = Invoke-RestMethod -Uri $AppInsightsIngestionEndpoint -Method Post -Headers $headers -Body $bodyAsCompressedJson
} }
} }