|
| 1 | +// ============================================================================= |
| 2 | +// TELEMETRY VALIDATION |
| 3 | +// Checks that PR #1365 telemetry events are arriving with correct properties. |
| 4 | +// Each query is self-contained — just copy-paste into Azure Data Explorer. |
| 5 | +// ============================================================================= |
| 6 | + |
| 7 | + |
| 8 | +// ============================================================================= |
| 9 | +// CHECK 0: UniqueMachines with Telemetry Changes |
| 10 | +// Shows unique machines per version for builds >= 1.23.10781012 (all stable + pre-release). |
| 11 | +// Use this to confirm the latest pre-release build has real users. |
| 12 | +// ============================================================================= |
| 13 | +let filtered = RawEventsVSCodeExt |
| 14 | +| where ServerTimestamp > ago(7d) |
| 15 | +| where ExtensionName == "ms-python.vscode-python-envs" |
| 16 | +| where ExtensionVersion != "" |
| 17 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtensionVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtensionVersion)) |
| 18 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012); |
| 19 | +filtered |
| 20 | +| summarize UniqueMachines = dcount(VSCodeMachineId) by ExtensionVersion |
| 21 | +| extend TotalUniqueMachines = toscalar(filtered | summarize dcount(VSCodeMachineId)) |
| 22 | +| order by UniqueMachines desc; |
| 23 | + |
| 24 | + |
| 25 | +// ============================================================================= |
| 26 | +// CHECK 1: Are all 4 events arriving? (3 new + 1 enhanced) |
| 27 | +// Expected: at least 1 row per event. If any row shows 0, that event is broken. |
| 28 | +// Broken down by extension version so you can confirm the new build is reporting. |
| 29 | +// ============================================================================= |
| 30 | +let allEvents = datatable(EventName: string) [ |
| 31 | + "ms-python.vscode-python-envs/manager_registration.failed", |
| 32 | + "ms-python.vscode-python-envs/manager_registration.skipped", |
| 33 | + "ms-python.vscode-python-envs/setup.hang_detected", |
| 34 | + "ms-python.vscode-python-envs/extension.manager_registration_duration" |
| 35 | +]; |
| 36 | +let observed = RawEventsVSCodeExt |
| 37 | +| where ServerTimestamp > ago(7d) |
| 38 | +| where EventName in ( |
| 39 | + "ms-python.vscode-python-envs/manager_registration.failed", |
| 40 | + "ms-python.vscode-python-envs/manager_registration.skipped", |
| 41 | + "ms-python.vscode-python-envs/setup.hang_detected", |
| 42 | + "ms-python.vscode-python-envs/extension.manager_registration_duration" |
| 43 | +) |
| 44 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 45 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 46 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 47 | +| summarize EventCount = count(), UniqueMachines = dcount(VSCodeMachineId) by EventName, ExtVersion; |
| 48 | +allEvents |
| 49 | +| join kind=leftouter observed on EventName |
| 50 | +| project |
| 51 | + EventName, |
| 52 | + ExtVersion = coalesce(ExtVersion, ""), |
| 53 | + EventCount = coalesce(EventCount, 0), |
| 54 | + UniqueMachines = coalesce(UniqueMachines, 0), |
| 55 | + Status = iff(coalesce(EventCount, 0) > 0, "✅ RECEIVING DATA", "⚠️ NO DATA YET") |
| 56 | +| order by EventName asc, ExtVersion desc; |
| 57 | + |
| 58 | + |
| 59 | +// ============================================================================= |
| 60 | +// CHECK 2: Enhanced event — does "result" property exist? |
| 61 | +// The existing event previously had only "duration". Now it should have "result". |
| 62 | +// Expected: rows with result = "success" (should be the majority) and maybe a few "error". |
| 63 | +// If result is empty/"", the property isn't being sent correctly. |
| 64 | +// ============================================================================= |
| 65 | +RawEventsVSCodeExt |
| 66 | +| where ServerTimestamp > ago(7d) |
| 67 | +| where EventName == "ms-python.vscode-python-envs/extension.manager_registration_duration" |
| 68 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 69 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 70 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 71 | +| summarize |
| 72 | + TotalEvents = count(), |
| 73 | + HasResult = countif(isnotempty(tostring(Properties.result))), |
| 74 | + ResultSuccess = countif(tostring(Properties.result) == "success"), |
| 75 | + ResultError = countif(tostring(Properties.result) == "error"), |
| 76 | + HasDuration = countif(todouble(Properties.duration) > 0) |
| 77 | +| extend |
| 78 | + ResultPopulatedPct = round(todouble(HasResult) / todouble(TotalEvents) * 100, 1), |
| 79 | + ErrorPct = round(todouble(ResultError) / todouble(HasResult) * 100, 2), |
| 80 | + Status = iff(HasResult == TotalEvents, "✅ ALL EVENTS HAVE result", "⚠️ SOME EVENTS MISSING result"); |
| 81 | + |
| 82 | + |
| 83 | +// ============================================================================= |
| 84 | +// CHECK 3: MANAGER_REGISTRATION.SKIPPED — property validation |
| 85 | +// Expected: managerName in {conda, pyenv, pipenv, poetry}, reason = "tool_not_found" |
| 86 | +// These should be common — most users don't have all 4 tools. |
| 87 | +// ============================================================================= |
| 88 | +let totalMachines = toscalar( |
| 89 | + RawEventsVSCodeExt |
| 90 | + | where ServerTimestamp > ago(7d) |
| 91 | + | where ExtensionName == "ms-python.vscode-python-envs" |
| 92 | + | where ExtensionVersion != "" |
| 93 | + | extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtensionVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtensionVersion)) |
| 94 | + | where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 95 | + | summarize dcount(VSCodeMachineId) |
| 96 | +); |
| 97 | +RawEventsVSCodeExt |
| 98 | +| where ServerTimestamp > ago(7d) |
| 99 | +| where EventName == "ms-python.vscode-python-envs/manager_registration.skipped" |
| 100 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 101 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 102 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 103 | +| summarize |
| 104 | + EventCount = count(), |
| 105 | + UniqueMachines = dcount(VSCodeMachineId) |
| 106 | + by ManagerName = tostring(Properties.managername), Reason = tostring(Properties.reason) |
| 107 | +| extend TotalUniqueMachines = totalMachines |
| 108 | +| extend MachinePct = round(todouble(UniqueMachines) / todouble(TotalUniqueMachines) * 100, 1) |
| 109 | +| order by EventCount desc; |
| 110 | + |
| 111 | + |
| 112 | +// ============================================================================= |
| 113 | +// CHECK 4: MANAGER_REGISTRATION.FAILED — property validation |
| 114 | +// Expected: managerName in {system, conda, pyenv, pipenv, poetry, shellStartupVars} |
| 115 | +// errorType in {spawn_timeout, spawn_enoent, permission_denied, canceled, parse_error, unknown} |
| 116 | +// This may have 0 rows if no one hit errors — that's fine. |
| 117 | +// |
| 118 | +// errorType reference (from errorClassifier.ts): |
| 119 | +// spawn_timeout — tool process started but hung or didn't respond in time |
| 120 | +// spawn_enoent — OS couldn't find the executable (ENOENT: not installed or not on PATH) |
| 121 | +// permission_denied — OS returned EACCES/EPERM (exists but no permission to run) |
| 122 | +// canceled — operation was stopped (user closed VS Code, workspace changed, CancellationToken fired) |
| 123 | +// parse_error — tool ran but returned unparseable output (malformed JSON, unexpected format) |
| 124 | +// unknown — didn't match any known pattern (catch-all for unexpected errors) |
| 125 | +// ============================================================================= |
| 126 | +let totalMachines = toscalar( |
| 127 | + RawEventsVSCodeExt |
| 128 | + | where ServerTimestamp > ago(7d) |
| 129 | + | where ExtensionName == "ms-python.vscode-python-envs" |
| 130 | + | where ExtensionVersion != "" |
| 131 | + | extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtensionVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtensionVersion)) |
| 132 | + | where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 133 | + | summarize dcount(VSCodeMachineId) |
| 134 | +); |
| 135 | +RawEventsVSCodeExt |
| 136 | +| where ServerTimestamp > ago(7d) |
| 137 | +| where EventName == "ms-python.vscode-python-envs/manager_registration.failed" |
| 138 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 139 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 140 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 141 | +| summarize |
| 142 | + EventCount = count(), |
| 143 | + UniqueMachines = dcount(VSCodeMachineId) |
| 144 | + by ManagerName = tostring(Properties.managername), ErrorType = tostring(Properties.errortype) |
| 145 | +| extend TotalUniqueMachines = totalMachines |
| 146 | +| extend MachinePct = round(todouble(UniqueMachines) / todouble(TotalUniqueMachines) * 100, 1) |
| 147 | +| order by EventCount desc; |
| 148 | + |
| 149 | + |
| 150 | +// ============================================================================= |
| 151 | +// CHECK 5: SETUP.HANG_DETECTED — property validation |
| 152 | +// Expected: failureStage in {nativeFinder, managerRegistration, envSelection, terminalWatcher, settingsListener} |
| 153 | +// This should have very few or 0 rows (hangs are rare). 0 is normal. |
| 154 | +// ============================================================================= |
| 155 | +let totalMachines = toscalar( |
| 156 | + RawEventsVSCodeExt |
| 157 | + | where ServerTimestamp > ago(7d) |
| 158 | + | where ExtensionName == "ms-python.vscode-python-envs" |
| 159 | + | where ExtensionVersion != "" |
| 160 | + | extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtensionVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtensionVersion)) |
| 161 | + | where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 162 | + | summarize dcount(VSCodeMachineId) |
| 163 | +); |
| 164 | +RawEventsVSCodeExt |
| 165 | +| where ServerTimestamp > ago(7d) |
| 166 | +| where EventName == "ms-python.vscode-python-envs/setup.hang_detected" |
| 167 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 168 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 169 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 170 | +| summarize |
| 171 | + EventCount = count(), |
| 172 | + UniqueMachines = dcount(VSCodeMachineId) |
| 173 | + by FailureStage = tostring(Properties.failurestage) |
| 174 | +| extend TotalUniqueMachines = totalMachines |
| 175 | +| extend MachinePct = round(todouble(UniqueMachines) / todouble(TotalUniqueMachines) * 100, 1) |
| 176 | +| order by EventCount desc; |
| 177 | + |
| 178 | + |
| 179 | +// ============================================================================= |
| 180 | +// CHECK 6: Registered vs Skipped — unique machine counts per manager |
| 181 | +// For each manager that can be skipped, compare registered vs skipped machine counts. |
| 182 | +// If a manager shows 0 registered AND 0 skipped, the telemetry path may be broken. |
| 183 | +// ============================================================================= |
| 184 | +let totalMachines = toscalar( |
| 185 | + RawEventsVSCodeExt |
| 186 | + | where ServerTimestamp > ago(7d) |
| 187 | + | where ExtensionName == "ms-python.vscode-python-envs" |
| 188 | + | where ExtensionVersion != "" |
| 189 | + | extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtensionVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtensionVersion)) |
| 190 | + | where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 191 | + | summarize dcount(VSCodeMachineId) |
| 192 | +); |
| 193 | +let skipped = RawEventsVSCodeExt |
| 194 | +| where ServerTimestamp > ago(7d) |
| 195 | +| where EventName == "ms-python.vscode-python-envs/manager_registration.skipped" |
| 196 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 197 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 198 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 199 | +| summarize SkippedMachines = dcount(VSCodeMachineId) by Manager = tostring(Properties.managername); |
| 200 | +let registered = RawEventsVSCodeExt |
| 201 | +| where ServerTimestamp > ago(7d) |
| 202 | +| where EventName == "ms-python.vscode-python-envs/environment_manager.registered" |
| 203 | +| extend ExtVersion = tostring(Properties["common.extversion"]) |
| 204 | +| extend _minor = toint(extract("^1\\.(\\d+)", 1, ExtVersion)), _patch = tolong(extract("^1\\.\\d+\\.(\\d+)", 1, ExtVersion)) |
| 205 | +| where _minor > 23 or (_minor == 23 and _patch >= 10781012) |
| 206 | +| extend RawManagerId = tostring(Properties.managerid) |
| 207 | +| where RawManagerId has_any ("conda", "pyenv", "pipenv", "poetry") |
| 208 | +| extend Manager = case( |
| 209 | + RawManagerId has "conda", "conda", |
| 210 | + RawManagerId has "pyenv", "pyenv", |
| 211 | + RawManagerId has "pipenv", "pipenv", |
| 212 | + RawManagerId has "poetry", "poetry", |
| 213 | + RawManagerId) |
| 214 | +| summarize RegisteredMachines = dcount(VSCodeMachineId) by Manager; |
| 215 | +skipped |
| 216 | +| join kind=fullouter registered on Manager |
| 217 | +| project |
| 218 | + Manager = coalesce(Manager, Manager1), |
| 219 | + RegisteredMachines = coalesce(RegisteredMachines, 0), |
| 220 | + SkippedMachines = coalesce(SkippedMachines, 0), |
| 221 | + TotalUniqueMachines = totalMachines |
| 222 | +| extend |
| 223 | + RegisteredPct = round(todouble(RegisteredMachines) / todouble(TotalUniqueMachines) * 100, 1), |
| 224 | + SkippedPct = round(todouble(SkippedMachines) / todouble(TotalUniqueMachines) * 100, 1) |
| 225 | +| order by Manager asc; |
| 226 | + |
| 227 | + |
| 228 | + |
0 commit comments