Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 2555a55

Browse files
vxfieldbamarshaScottCarda-MS
authored
Quantum Development Kit Telemetry Library (#1199)
Co-authored-by: Sarah Marshall <[email protected]> Co-authored-by: Scott Carda <[email protected]>
1 parent 487d31d commit 2555a55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4156
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ src/ProjectTemplates/Quantum.Test1/.template.config/template.json
368368
src/QsCompiler/QirGeneration/QirGeneration.nuspec
369369
/examples/QIR/Development/qir/*
370370
/examples/QIR/Development/build
371+
src/Telemetry/Tests/coverage.json
372+
src/Telemetry/.vscode/settings.json
371373

372374
# MSBuild logs
373375
MSBuild_Logs/

build/build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ $all_ok = $True
142142
Build-One '../QsCompiler.sln'
143143
Build-One '../examples/QIR/QIR.sln'
144144
Build-One '../src/QuantumSdk/Tools/Tools.sln'
145+
Build-One '../src/Telemetry/Telemetry.sln'
145146
Build-One '../QsFmt.sln'
146147

147148
if ($Env:ENABLE_VSIX -ne "false") {

build/init.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ steps:
3131
inputs:
3232
command: 'custom'
3333
customCommand: 'install -g npm@latest'
34+

build/set-env.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ $ErrorActionPreference = 'Stop'
55

66
Write-Host "Setting up build environment variables"
77

8+
# Enable the QDK Telemetry Library to throw exceptions
9+
# This is useful to capture unexpected unhandled exceptions as we
10+
# test telemetry-related code
11+
$env:ENABLE_QDK_TELEMETRY_EXCEPTIONS = "1"
12+
813
If ($Env:BUILD_CONFIGURATION -eq $null) { $Env:BUILD_CONFIGURATION ="Debug" }
914
If ($Env:BUILD_VERBOSITY -eq $null) { $Env:BUILD_VERBOSITY ="m" }
1015
If ($Env:ASSEMBLY_VERSION -eq $null) { $Env:ASSEMBLY_VERSION ="0.0.1.0" }

build/test.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function Test-One {
4040

4141

4242
Test-One '../QsCompiler.sln'
43+
Test-One '../src/Telemetry/Telemetry.sln'
4344
Test-One '../QsFmt.sln'
4445

4546
if (-not $all_ok) {

src/Telemetry/.vscode/launch.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "C# Sample App",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/Samples/CSharp/bin/Debug/netcoreapp3.1/sampleTelAppCs.dll",
13+
"args": [],
14+
"console": "internalConsole",
15+
"stopAtEntry": false
16+
},
17+
{
18+
"name": "F# Sample App",
19+
"type": "coreclr",
20+
"request": "launch",
21+
"preLaunchTask": "build",
22+
"program": "${workspaceFolder}/Samples/FSharp/bin/Debug/netcoreapp3.1/sampleTelAppFs.dll",
23+
"args": [],
24+
"console": "internalConsole",
25+
"stopAtEntry": false
26+
},
27+
{
28+
"name": "Tests.OutOfProcessExe",
29+
"type": "coreclr",
30+
"request": "launch",
31+
"preLaunchTask": "build",
32+
"program": "${workspaceFolder}/Tests.OutOfProcessExe/bin/Debug/netcoreapp3.1/outofprocess.dll",
33+
"args": ["--OUT_OF_PROCESS_TELEMETRY_UPLOAD", "--TELEMETRY_TEST_MODE"],
34+
"console": "integratedTerminal",
35+
"stopAtEntry": false
36+
},
37+
{
38+
"name": ".NET Core Attach",
39+
"type": "coreclr",
40+
"request": "attach"
41+
}
42+
]
43+
}

src/Telemetry/.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Telemetry.sln",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/Telemetry.sln",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"${workspaceFolder}/Telemetry.sln",
36+
"/property:GenerateFullPaths=true",
37+
"/consoleloggerparameters:NoSummary"
38+
],
39+
"problemMatcher": "$msCompile"
40+
}
41+
]
42+
}

src/Telemetry/Build/Build.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
Push-Location $PSScriptRoot/../
5+
6+
dotnet build
7+
8+
Pop-Location

src/Telemetry/Build/Test.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
Push-Location $PSScriptRoot/../
5+
6+
dotnet test
7+
8+
Pop-Location
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
Push-Location $PSScriptRoot/../
5+
6+
dotnet test --collect:"XPlat Code Coverage"
7+
8+
$coverageFile = (Get-ChildItem $PSScriptRoot/../Tests/TestResults/*/coverage.cobertura.xml -Recurse |
9+
Sort-Object -pro LastWriteTime -Descending |
10+
Select -First 1).FullName
11+
12+
Push-Location $PSScriptRoot/../Tests/
13+
dotnet reportgenerator "-reports:$coverageFile" "-targetdir:TestResults/html" -reporttypes:HTML;
14+
Pop-Location
15+
16+
$reportFile = Resolve-Path "$PSScriptRoot/../Tests/TestResults/html/index.htm"
17+
18+
Write-Output "Attempting to open: file:///$reportFile"
19+
20+
Start-Process "file:///$reportFile"
21+
22+
Pop-Location

0 commit comments

Comments
 (0)