npm update brace-expansion (#243)
Agent-Logs-Url: https://github.com/microsoft/vscode-extension-telemetry/sessions/3e175143-886f-41da-b32c-0b6e4bb36b7b
Co-authored-by: copilot-swe-agent[bot] 198982749+Copilot@users.noreply.github.com Co-authored-by: rzhao271 7199958+rzhao271@users.noreply.github.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
@vscode/extension-telemetry
This module provides a consistent way for extensions to report telemetry over Application Insights. The module respects the user’s decision about whether or not to send telemetry data. See telemetry extension guidelines for more information on using telemetry in your extension.
Follow guide to set up Application Insights in Azure and get your connection string. Don’t worry about hardcoding it, it is not sensitive.
Install
With npm:
npm install @vscode/extension-telemetryWith yarn:
yarn add @vscode/extension-telemetryUsage
Setup
Sending Events
Use this method for sending general events to App Insights.
Sending Errors as Events
Use this method for sending error telemetry as traditional events to App Insights.
Note: To filter out sensitive properties (e.g., stack traces), use
replacementOptionsin the constructor rather than passing properties to drop as a parameter.Advanced Features (v1.5.0+)
Custom Endpoints and Configuration
Route telemetry to non-Azure endpoints (e.g., GitHub telemetry) and configure common properties and static tags:
When to use constructor options:
Per-Event Tag Overrides
For dynamic tags that change per event (e.g., user tracking IDs from authentication tokens):
Tag Merging Priority (lowest to highest):
tagOverrides(static, set at initialization)setContextTag()(can be set after construction)tagOverrides(highest priority, dynamic per event)Runtime Tag Management (Advanced)
For edge cases where tags are not available at construction or need to change at runtime:
When to use
setContextTag():Note: For most use cases, prefer constructor
tagOverridesoversetContextTag()for better immutability and clarity.Dangerous Methods (Bypass Telemetry Settings)
These methods send telemetry without checking the user’s telemetry settings. Only use them in controlled environments such as CI pipelines or during development testing.
⚠️ Warning: These methods bypass the user’s telemetry opt-in preference. Only use them when you have explicit consent or in non-user-facing scenarios (e.g., automated testing, CI/CD pipelines).
Common Properties
common.extname- The extension namecommon.extversion- The extension versioncommon.vscodemachineid- A common machine identifier generated by VS Codecommon.vscodesessionid- A session identifier generated by VS Codecommon.vscodecommithash- A VS Code commit hashcommon.vscodeversion- The version of VS Code running the extensioncommon.os- The OS running VS Codecommon.platformversion- The version of the OS/Platformcommon.product- What Vs code is hosted in, i.e. desktop, github.dev, codespaces.common.uikind- Web or Desktop indicating where VS Code is runningcommon.remotename- A name to identify the type of remote connection.otherindicates a remote connection not from the 3 main extensions (ssh, docker, wsl).common.nodeArch- What architecture of node is running. i.e. arm or x86. On the web it will just sayweb.License
MIT