microsoft / microsoft/GitHub-Copilot-for-Azure
Rework telemetry scripts
- Dominant language
- Python
- Stars
- 250
- Forks
- 204
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
Having reviewed our telemetry scripts ([track-telemetry.ps1](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/main/plugin/hooks/scripts/track-telemetry.ps1)/[track-telemetry.sh](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/main/plugin/hooks/scripts/track-telemetry.sh)) and the hook.json files that call them, there are several issues that should be addressed:
1. We're using the same `postToolUse` hook in all clients. However, the shape of the JSON passed to the hook script varies from one client to another. Rather than one script that tries to accomodate all clients, each client should have its own script tailored to its output format. I believe this will be easier to maintain going forward.
2. Claude has a `postToolUseFailure` hook that is called when a tool fails. I'm not sure if this is called in addition to `postToolUse` or in place of it; we need to investigate.
3. The clients have very different approaches to handling different operating systems. VS Code has support for OS-specific commands (`mac`, `linux`, and `windows`) while Copilot CLI has shell-specific commands (`bash` and `powershell`). Claude always wants to use bash, with PowerShell as a fallback (though it is unclear how that would work). We should consider replacing our separate .sh and .ps1 scripts with a single, cross-platform NodeJS script and then invoking that with `npx`. Since we already need `npx` for the scripts to send the telemetry (via Azure MCP) this does not introduce any new requirements.
4. In at least some cases a client will pick up the default hooks file specified by the default plugin.json. Given the differences between clients, I think it would be better to have a client-specific plugin.json for each client we support, with each of those point to a client-specific hooks.json, which in turn runs client-specific scripts.
Contributor guide
Assessment
This issue has not been assessed yet.