Skip to content

feat: add PET version and build ID telemetry properties to enhance performance tracking#1548

Draft
eleanorjboyd wants to merge 4 commits into
microsoft:mainfrom
eleanorjboyd:excess-marten
Draft

feat: add PET version and build ID telemetry properties to enhance performance tracking#1548
eleanorjboyd wants to merge 4 commits into
microsoft:mainfrom
eleanorjboyd:excess-marten

Conversation

@eleanorjboyd

Copy link
Copy Markdown
Member

goes along with microsoft/python-environment-tools#470 to support getting PET versions as telemetry to track performance regression and improvements across specific version numbers

@eleanorjboyd eleanorjboyd requested a review from Copilot May 29, 2026 21:55
@eleanorjboyd eleanorjboyd self-assigned this May 29, 2026
@eleanorjboyd eleanorjboyd marked this pull request as draft May 29, 2026 21:55
@eleanorjboyd eleanorjboyd added the debt Code quality issues label May 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR augments existing PET (Python Environment Tools) performance/health telemetry by fetching PET’s version/build identifier via a new info JSON-RPC call and attaching those properties to key PET events, enabling performance tracking across PET versions.

Changes:

  • Add a fire-and-forget PET info request and cache the response to stamp subsequent telemetry with petVersion/petBuildId.
  • Include petVersion and petBuildId properties on pet.refresh, pet.resolve, and pet.process_restart telemetry events.
  • Register the new telemetry properties in the GDPR mapping/types.
Show a summary per file
File Description
src/managers/common/nativePythonFinder.ts Fetches/caches PET info and adds petVersion/petBuildId to PET telemetry payloads.
src/common/telemetry/constants.ts Declares the new telemetry properties and adds GDPR metadata/type annotations for relevant PET events.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread src/managers/common/nativePythonFinder.ts
eleanorjboyd and others added 4 commits June 5, 2026 14:15
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
eleanorjboyd pushed a commit to microsoft/python-environment-tools that referenced this pull request Jun 9, 2026
…ression tracking (#473)

## Background

PET (Python Environment Tools) is a Rust-based JSONRPC server used by
the VS Code Python extension to discover Python environments. PET does
not send its own telemetry — instead, it returns metadata to the calling
extension (vscode-python-environments), which forwards it via telemetry.

To help catch regressions, we need a way to know exactly which PET build
a user is running by querying telemetry. [PR
#470](#470)
added a JSONRPC `info` request that returns PET's version and an
optional CI build ID. However, the build number alone isn't enough to
pinpoint the exact source code — we also need the git commit hash.

This PR extends the `info` response to include the **git commit SHA**
baked into the binary at build time. On the extension side, the
companion PR
([vscode-python-environments#1548](microsoft/vscode-python-environments#1548))
passes this information along to telemetry, so we can correlate
user-reported issues or regressions back to the specific PET commit.

## What Changed

### 1. Build script (`crates/pet/build.rs`)

- Added support for three new environment variables that CI systems set
automatically:
  - `PET_COMMIT_SHA` — explicit override (highest priority)
  - `BUILD_SOURCEVERSION` — set by Azure Pipelines
  - `GITHUB_SHA` — set by GitHub Actions
- When any of these is present and non-empty, the value is embedded into
the binary as a compile-time constant via
`cargo:rustc-env=PET_COMMIT_SHA=...`.

### 2. JSONRPC response (`crates/pet/src/jsonrpc.rs`)

- Added a new optional `commit_sha` field to the `InfoResponse` struct.
- `InfoResponse::current()` populates it from the compile-time
`PET_COMMIT_SHA` env var (same pattern used for `build_id`).
- For local dev builds where no CI env var is set, the field is `None`
and omitted from the JSON response.

### 3. JSONRPC documentation (`docs/JSONRPC.md`)

- Updated the `InfoResponse` TypeScript interface to document the new
`commitSha?: string` field, including where the value is sourced from.

### 4. Tests (`crates/pet/src/jsonrpc.rs`,
`crates/pet/tests/jsonrpc_server_test.rs`,
`crates/pet/tests/jsonrpc_client.rs`)

- Added `commit_sha` field to the test client's `PetInfoResponse`
struct.
- Added assertions that `commit_sha`, when present, is non-empty
(mirrors existing `build_id` assertion pattern).
- Added clarifying comments explaining that both `build_id` and
`commit_sha` are `None` in local dev builds and only populated in CI.

## How It Works

```
CI build (Azure Pipelines / GitHub Actions)
  ↓ sets BUILD_SOURCEVERSION or GITHUB_SHA
build.rs captures it → bakes into binary as PET_COMMIT_SHA
  ↓
JSONRPC `info` request → returns { petVersion, buildId, commitSha }
  ↓
vscode-python-environments extension → includes commitSha in telemetry
  ↓
Team queries telemetry → correlates regressions to exact PET commit
```

## Related PRs

- [PET PR
#470](#470) —
Added the `info` JSONRPC request with version and build ID (merged)
- [vscode-python-environments PR
#1548](microsoft/vscode-python-environments#1548)
— Extension-side: passes PET version/build/commit info to telemetry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Code quality issues skip tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants