Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ configuration:
This PR has been labeled with `Area-Telemetry`. Please ensure that any telemetry changes in this PR

* comply with the [published guidance](https://learn.microsoft.com/dotnet/core/tools/telemetry#data-points)

* are added to the [repo-local telemetry documentation](./documentation/project-docs/telemetry.md)

* get a matching .NET Docs issue raised to document the telemetry changes

* Go to https://learn.microsoft.com/dotnet/core/tools/telemetry

* Scroll down to the bottom and click the 'Open a documentation issue' link to create an issue with pre-filled details
- requestReview:
reviewer: dsplaisted
Expand Down
2 changes: 1 addition & 1 deletion documentation/project-docs/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Every telemetry event automatically includes these common properties:
| **Telemetry Profile** | Custom telemetry profile (if set via env var) | Custom value or null |
| **Docker Container** | Whether running in Docker container | `True` or `False` |
| **CI** | Whether running in CI environment | `True` or `False` |
| **LLM** | Detected LLM/assistant environment identifiers (comma-separated) | `claude`, `cursor`, `gemini`, `copilot`, `generic_agent` |
| **LLM** | Detected LLM/assistant environment identifiers (comma-separated) | `claude`, `cursor`, `gemini`, `copilot`, `generic_agent`, `codex` |
| **Current Path Hash** | SHA256 hash of current directory path | Hashed value |
| **Machine ID** | SHA256 hash of machine MAC address (or GUID if unavailable) | Hashed value |
| **Machine ID Old** | Legacy machine ID for compatibility | Hashed value |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ internal class LLMEnvironmentDetectorForTelemetry : ILLMEnvironmentDetector
{
private static readonly EnvironmentDetectionRuleWithResult<string>[] _detectionRules = [
// Claude Code
new EnvironmentDetectionRuleWithResult<string>("claude", new AnyPresentEnvironmentRule("CLAUDECODE")),
new EnvironmentDetectionRuleWithResult<string>("claude", new BooleanEnvironmentRule("CLAUDECODE")),
// Cursor AI
new EnvironmentDetectionRuleWithResult<string>("cursor", new AnyPresentEnvironmentRule("CURSOR_EDITOR")),
new EnvironmentDetectionRuleWithResult<string>("cursor", new BooleanEnvironmentRule("CURSOR_EDITOR")),
// Gemini
new EnvironmentDetectionRuleWithResult<string>("gemini", new BooleanEnvironmentRule("GEMINI_CLI")),
// GitHub Copilot
new EnvironmentDetectionRuleWithResult<string>("copilot", new BooleanEnvironmentRule("GITHUB_COPILOT_CLI_MODE")),
// OpenAI Codex
new EnvironmentDetectionRuleWithResult<string>("codex", new BooleanEnvironmentRule("CODEX_THREAD_ID")),
// (proposed) generic flag for Agentic usage
new EnvironmentDetectionRuleWithResult<string>("generic_agent", new BooleanEnvironmentRule("AGENT_CLI")),
];
Expand Down
1 change: 1 addition & 0 deletions test/dotnet.Tests/TelemetryCommonPropertiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public void TelemetryCommonPropertiesShouldContainSessionId(string? sessionId)
{ new Dictionary<string, string> { { "GEMINI_CLI", "false" } }, null },
{ new Dictionary<string, string> { { "GITHUB_COPILOT_CLI_MODE", "false" } }, null },
{ new Dictionary<string, string> { { "AGENT_CLI", "false" } }, null },
{ new Dictionary<string, string> { { "CODEX_THREAD_ID", "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" } }, "codex" },
{ new Dictionary<string, string>(), null },
};

Expand Down
Loading