Commit c6e4fe7
authored
Improve telemetry error classification to reduce 'unknown' error types (#1409)
## Problem
The `classifyError()` function in the telemetry error classifier had
limited coverage — only 6 error categories were recognized. Many errors
from manager registration (`MANAGER_REGISTRATION_FAILED`) were falling
into the `'unknown'` bucket, making it difficult to diagnose failures
from telemetry data.
After tracing every code path that leads to
`MANAGER_REGISTRATION_FAILED` telemetry (pipenv, pyenv, poetry, conda,
system, and shellStartupVars registration), we identified 6 common error
patterns that were unclassified.
## Changes
Added 6 new error types to `DiscoveryErrorType` and corresponding
classification logic:
| New Type | What It Catches | Detection Method |
|---|---|---|
| `tool_not_found` | "Conda not found", "Python extension not found",
"Poetry executable not found" | Message pattern |
| `command_failed` | `Failed to run "conda ..."`, `Failed to run poetry
...`, `Error spawning conda: ...` | Message pattern |
| `connection_error` | PET process dies mid-request, JSON-RPC connection
closed/disposed | `instanceof rpc.ConnectionError` |
| `rpc_error` | PET returns a JSON-RPC error response (e.g., internal
error, method not found) | `instanceof rpc.ResponseError` |
| `process_crash` | PET restarting, failed after N restart attempts,
failed to create stdio streams | Message pattern |
| `already_registered` | Duplicate manager registration (race condition)
| `instanceof BaseError` |
Every message pattern is based on exact `throw new Error(...)` strings
found in the codebase — no speculative matching.
## Ordering
The check order is designed to avoid misclassification:
1. `instanceof` checks first (most reliable, no false positives)
2. `error.code` checks for Node.js errno codes
3. Message patterns from most specific to least specific (e.g., `'not
found'` is after `'json'` to avoid catching JSON validation errors)
4. Error name fallback for cancellation variants
5. `'unknown'` as final fallback
## Testing
Added 7 new test cases covering all new error types with real-world
error messages from the codebase. All 15 tests pass.1 parent eff0768 commit c6e4fe7
File tree
2 files changed
+104
-1
lines changed- src
- common/telemetry
- test/common/telemetry
2 files changed
+104
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
10 | 18 | | |
11 | 19 | | |
12 | 20 | | |
| |||
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
25 | 48 | | |
26 | 49 | | |
27 | 50 | | |
| |||
35 | 58 | | |
36 | 59 | | |
37 | 60 | | |
38 | | - | |
| 61 | + | |
39 | 62 | | |
40 | 63 | | |
41 | 64 | | |
42 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
43 | 73 | | |
44 | 74 | | |
45 | 75 | | |
46 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
47 | 89 | | |
48 | 90 | | |
49 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
67 | 128 | | |
68 | 129 | | |
0 commit comments