diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index 806e13e53edc..2ebcddb88bcd 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -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 diff --git a/documentation/project-docs/telemetry.md b/documentation/project-docs/telemetry.md index e559f60bb25b..8183dadc2109 100644 --- a/documentation/project-docs/telemetry.md +++ b/documentation/project-docs/telemetry.md @@ -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 | diff --git a/src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs b/src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs index b37f9b5d0830..af0bd23ca406 100644 --- a/src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs +++ b/src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs @@ -14,8 +14,10 @@ internal class LLMEnvironmentDetectorForTelemetry : ILLMEnvironmentDetector new EnvironmentDetectionRuleWithResult("gemini", new BooleanEnvironmentRule("GEMINI_CLI")), // GitHub Copilot new EnvironmentDetectionRuleWithResult("copilot", new BooleanEnvironmentRule("GITHUB_COPILOT_CLI_MODE")), + // OpenAI Codex + new EnvironmentDetectionRuleWithResult("codex", new BooleanEnvironmentRule("CODEX_THREAD_ID")), // (proposed) generic flag for Agentic usage - new EnvironmentDetectionRuleWithResult("generic_agent", new BooleanEnvironmentRule("AGENT_CLI")), + new EnvironmentDetectionRuleWithResult("generic_agent", new AnyPresentEnvironmentRule("AGENT_CLI")), ]; /// diff --git a/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs b/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs index 4e28b92479d7..2b312a6396b3 100644 --- a/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs +++ b/test/dotnet.Tests/TelemetryCommonPropertiesTests.cs @@ -242,6 +242,7 @@ public void TelemetryCommonPropertiesShouldContainSessionId(string? sessionId) { new Dictionary { { "GEMINI_CLI", "false" } }, null }, { new Dictionary { { "GITHUB_COPILOT_CLI_MODE", "false" } }, null }, { new Dictionary { { "AGENT_CLI", "false" } }, null }, + { new Dictionary { { "CODEX_THREAD_ID", "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" } }, "codex" }, { new Dictionary(), null }, };