Commit f735717
feat: enrich telemetry with pythonVersion and dbtCoreVersion customAttributes
Production telemetry currently carries `common.os` / `common.nodeArch` /
`common.extversion` etc. on every event but **not** the user's Python
interpreter version or installed dbt-core distribution version. That's a
real blindspot — App Insights can't split error clusters by Python
version (e.g. is `pythonBridgeInitPythonError "mashumaro
UnserializableField"` a Python 3.13 + mashumaro 3.14 incompat or
something else?) and we can't tell whether `catalogPythonError "missing
used_schemas"` correlates with a specific dbt-core minor.
Adds two customAttributes that get merged into every event going
forward via `TelemetryService.setTelemetryCustomAttribute`:
- `pythonVersion` — sourced from `PythonEnvironment.pythonVersion`
(already populated via the VS Code Python extension's API on
interpreter activation, no additional probe needed).
- `dbtCoreVersion` — sourced from a small `child_process.spawn` probe
in `src/telemetry/versionProbes.ts` that runs
`python -c "from importlib.metadata import version; print(version('dbt-core'))"`.
Reads dist-info directly so it survives even when dbt's own import
chain is broken (the failure mode PR #96 targeted) — the bridge can
be dead and we still get the version.
Both are best-effort: probe failure → no customAttribute set rather
than blocking activation. Wired into `DBTPowerUserExtension.activate`
after `initializeDBTProjects` (when the Python interpreter is known)
plus a refresh on `pythonEnvironment.onPythonEnvironmentChanged` so the
dimensions track interpreter changes.
`probeDbtCoreVersion` accepts an injectable `SpawnFn` parameter
defaulted to `child_process.spawn`. `import * as childProcess` produces
ESM-style bindings that resist `jest.spyOn` / `jest.mock` redefinition
under ts-jest, so the tests pass their own spawner directly. Adds 6
unit tests covering: success, empty stdout (PackageNotFoundError),
non-zero exit, error event, sync throw, and timeout.
After this ships and rolls out, App Insights queries can split by
`customDimensions.pythonVersion == "3.13.0"` or
`customDimensions.dbtCoreVersion startswith "1.10"` on every event,
not just the wrapper-failure events. Dashboards become diagnostic by
construction without per-event injection.
Tests: 33 suites / 486 passed (32 prior + 1 new).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 68ef665 commit f735717
4 files changed
Lines changed: 363 additions & 1 deletion
File tree
- src
- telemetry
- test/suite
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1342 | 1342 | | |
1343 | 1343 | | |
1344 | 1344 | | |
1345 | | - | |
| 1345 | + | |
1346 | 1346 | | |
1347 | 1347 | | |
1348 | 1348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
| |||
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
100 | 136 | | |
101 | 137 | | |
102 | 138 | | |
| |||
121 | 157 | | |
122 | 158 | | |
123 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
124 | 212 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
| |||
0 commit comments