Skip to content

Commit

Permalink
Adds some basic telemetry
Browse files Browse the repository at this point in the history
- Currently the following telemetry events have been added
  - A telemetry event on launch
  - A telemetry event on exit (including exit code)
  - A telemetry event for each command executed including whether or not it was successful
  - Telemetry events for the init commands to start to build a funnel for that flow to identify common failure points
  - A telemetry event about the status of loading and parsing a saved config.json
- Abstracts away the actual telemetry system and code used. The goal is to change this in the near future
- Adds a CI/CD option to (for now) enable or disable telemetry. Telemetry is disabled by default
- Added CI/CD configuration to switch to using the production telemetry tenant instead of the developer one
- Added some flow charts using Markdown and Mermaid with the current init flow, a proposed simplified init flow, and a more detailed current flow that tries to capture method calls as well
- Fixed a bug in the LoginHelpers flow where it would not properly clear previous text
- Fixed a bug in the code that verified the saved config.json that was not handling empty or invalid JSON
  • Loading branch information
ralph-msft authored Mar 12, 2024
1 parent aad961d commit 933810f
Show file tree
Hide file tree
Showing 43 changed files with 2,368 additions and 380 deletions.
46 changes: 37 additions & 9 deletions .azure/pipelines/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ pr:
pool:
name: SkymanUbuntu2004Hosted

parameters:
- name: signNugetPackages
displayName: Sign NuGet packages
type: boolean
default: true
- name: telemetryType
displayName: Telemetry to use
type: string
default: None
values:
- None
- Aria

variables:
- group: 'Azure AI CLI Telemetry configuration'
- name: telemetry.type
# NOTE: Do NOT change the name of this variable without also updating the corresponding
# src\ai\.x\config\telemetry.config.json file. This name needs to be a JPath like
# expression to replace a specific value in that CLI telemetry JSON configuration in the
# FileTransform step in the BuildStage below
value: ${{ parameters.telemetryType }}
- name: telemetry.aria.tenantId
# NOTE: Do NOT change the name of this variable without updating the telemetry JSON config
value: $(AriaTenantId_Release)

stages:

- stage: SetupStage
Expand All @@ -33,11 +58,13 @@ stages:
AICLISemVerVersion: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLISemVerVersion']]
AICLINuPkgFileName: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLINuPkgFileName']]
steps:
- task: DotNetCoreCLI@2
displayName: Restore packages
- task: FileTransform@1
displayName: 'Update telemetry configuration'
inputs:
command: restore
projects: 'src/ai/**/*.csproj'
folderPath: '$(Build.SourcesDirectory)/src/ai/.x/config'
fileType: json
targetFiles: telemetry.config.json
- task: NuGetAuthenticate@1
- task: DotNetCoreCLI@2
displayName: Build
inputs:
Expand All @@ -56,11 +83,12 @@ stages:
inputs:
packageType: 'sdk'
version: '2.1.x'
- template: sign-nuget.yaml
parameters:
displayName: 'Sign AI CLI NuGet package'
folderPath: '$(Build.ArtifactStagingDirectory)'
pattern: '$(AICLINuPkgFileName)'
- ${{ if eq(parameters.signNugetPackages, true) }}:
- template: sign-nuget.yaml
parameters:
displayName: 'Sign AI CLI NuGet package'
folderPath: '$(Build.ArtifactStagingDirectory)'
pattern: '$(AICLINuPkgFileName)'
- task: Bash@3
displayName: 'Create installation script'
inputs:
Expand Down
5 changes: 3 additions & 2 deletions .azure/pipelines/test_setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ steps:
- bash: |
env | sort
which dotnet
dotnet --version
dotnet --info
echo "TestResultsPath: $(TestResultsPath)"
mkdir $(TestResultsPath)
echo "LocalInputPath: $(LocalInputPath)"
Expand All @@ -62,6 +62,7 @@ steps:
# -----------------------------------------------------------------------------
# Build the YamlTestAdapter
# -----------------------------------------------------------------------------
- task: NuGetAuthenticate@1
- task: DotNetCoreCLI@2
displayName: Build Test Adapters
inputs:
Expand All @@ -71,5 +72,5 @@ steps:
projects: '**/*adapter/*.csproj'
arguments:
-c $(BuildConfiguration)
/p:Platform=x64
/p:Platform=AnyCPU
/p:LocalBinOutputPath="$(LocalBinOutputPath)"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
**/obj/*
ideas/website/node_modules/**
testresults/**
**/launchSettings.json
**/launchSettings.json
*.user
1 change: 0 additions & 1 deletion .sscignore

This file was deleted.

7 changes: 7 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="CarbonSpx" value="https://msasg.pkgs.visualstudio.com/Skyman/_packaging/CarbonSpx/nuget/v3/index.json" />
</packageSources>
</configuration>
19 changes: 19 additions & 0 deletions ai-cli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RecordedYamlTestAdapter", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "speech-extension", "src\extensions\speech_extension\speech-extension.csproj", "{CED7C805-0435-4BF7-A42F-9F3BBF14A18F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "telemetry.aria", "src\telemetry\telemetry.aria.csproj", "{306A3CD6-91C2-450B-9995-79701CE63FE2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{68834003-CCC2-44D7-9EA4-F9B6C65CFC99}"
ProjectSection(SolutionItems) = preProject
NuGet.config = NuGet.config
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -157,6 +164,18 @@ Global
{CED7C805-0435-4BF7-A42F-9F3BBF14A18F}.Release|x64.Build.0 = Release|Any CPU
{CED7C805-0435-4BF7-A42F-9F3BBF14A18F}.Release|x86.ActiveCfg = Release|Any CPU
{CED7C805-0435-4BF7-A42F-9F3BBF14A18F}.Release|x86.Build.0 = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|x64.ActiveCfg = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|x64.Build.0 = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|x86.ActiveCfg = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|x86.Build.0 = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|Any CPU.Build.0 = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|x64.ActiveCfg = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|x64.Build.0 = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|x86.ActiveCfg = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 933810f

Please sign in to comment.