Enterprise OTel managed-settings policy#323171
Closed
zhichli wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds enterprise managed-settings policy support for Copilot OpenTelemetry across both the VS Code “agent host” surface (chat.agentHost.otel.*) and the Copilot extension surface (github.copilot.chat.otel.*), using a shared telemetry.* managed-settings key set and policyReference wiring so one policy governs both settings trees.
Changes:
- Extend managed-settings ingestion to accept and flatten
telemetry.*keys (including nestedtelemetry.dbSpanExporter.enabled). - Register new configuration policies for
chat.agentHost.otel.*and reference them from Copilot extension settings. - Update OTel config/env precedence logic and add tests/docs to reflect enterprise policy priority.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/services/accounts/test/browser/managedSettings.test.ts | Adds coverage ensuring telemetry.* is flattened into dot-path managed settings. |
| src/vs/workbench/services/accounts/browser/managedSettings.ts | Extends server response typing to include a telemetry block. |
| src/vs/platform/policy/common/copilotManagedSettings.ts | Adds managed-settings key constants for telemetry.*. |
| src/vs/platform/agentHost/test/node/otel/agentHostOTelService.integrationTest.ts | Adds integration tests for policy-vs-env precedence in agent-host env construction. |
| src/vs/platform/agentHost/OTEL.md | Updates docs for settings→env translation precedence including enterprise policy overrides. |
| src/vs/platform/agentHost/node/nodeAgentHostStarter.ts | Plumbs configuration policyValue into agent-host OTel env construction. |
| src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts | Same policy plumbing for the Electron main starter. |
| src/vs/platform/agentHost/common/agentService.ts | Implements policy override/clearing behavior in buildAgentHostOTelEnv. |
| src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts | Registers new enterprise policies and maps managed-settings telemetry.* to OTel settings. |
| extensions/copilot/src/platform/otel/common/test/otelConfig.spec.ts | Adds tests asserting policy precedence over env/settings. |
| extensions/copilot/src/platform/otel/common/otelConfig.ts | Implements policy-aware precedence in resolveOTelConfig. |
| extensions/copilot/src/extension/extension/vscode-node/services.ts | Attempts to feed policy values into OTel config resolution from extension settings. |
| extensions/copilot/package.json | Adds policyReference entries for Copilot extension OTel settings. |
| extensions/copilot/docs/monitoring/agent_monitoring.md | Documents enterprise managed-settings keys and updated precedence rules. |
| extensions/copilot/docs/monitoring/agent_monitoring_arch.md | Updates architecture doc precedence and enabledVia semantics. |
| build/lib/policies/policyData.jsonc | Updates generated policy catalog to include the new Copilot OTel policies. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 7
- Review effort level: Low
Comment on lines
291
to
+307
| @@ -298,6 +299,12 @@ export function registerServices(builder: IInstantiationServiceBuilder, extensio | |||
| settingMaxAttributeSizeChars: otelSettings.get<number>('maxAttributeSizeChars'), | |||
| settingOutfile: otelSettings.get<string>('outfile') || undefined, | |||
| settingDbSpanExporter: otelSettings.get<boolean>('dbSpanExporter.enabled'), | |||
| policyEnabled: policyValue<boolean>('enabled'), | |||
| policyExporterType: policyValue<'otlp-grpc' | 'otlp-http' | 'console' | 'file'>('exporterType'), | |||
| policyOtlpEndpoint: policyValue<string>('otlpEndpoint'), | |||
| policyCaptureContent: policyValue<boolean>('captureContent'), | |||
| policyOutfile: policyValue<string>('outfile'), | |||
| policyDbSpanExporter: policyValue<boolean>('dbSpanExporter.enabled'), | |||
| const dbSpanExporter = input.policyDbSpanExporter ?? input.settingDbSpanExporter ?? false; | ||
|
|
||
| // Determine if enabled: env > setting > dbSpanExporter > default(false) | ||
| const policyMandatesOtlp = input.policyOtlpEndpoint !== undefined || input.policyExporterType !== undefined; |
Comment on lines
+385
to
+388
| if (policySettings.exporterType !== undefined) { | ||
| setPolicy(AgentHostOTelEnvVars.ExporterType, policySettings.exporterType); | ||
| setPolicy(AgentHostOTelEnvVars.FilePath, ''); | ||
| } |
Comment on lines
+146
to
+149
| { | ||
| "key": "chat.agentHost.otel.enabled", | ||
| "name": "CopilotOtelEnabled", | ||
| "category": "InteractiveSession", |
| "policyReference": { | ||
| "name": "CopilotOtelEnabled" | ||
| }, | ||
| "markdownDescription": "Enable OpenTelemetry trace/metric/log emission for Copilot Chat operations. Configurable in user settings only. Env var `COPILOT_OTEL_ENABLED` takes precedence. Requires window reload.", |
| "policyReference": { | ||
| "name": "CopilotOtelEndpoint" | ||
| }, | ||
| "markdownDescription": "OTLP collector endpoint URL for Copilot Chat OTel data. Configurable in user settings only. Env var `OTEL_EXPORTER_OTLP_ENDPOINT` takes precedence. Requires window reload.", |
| "policyReference": { | ||
| "name": "CopilotOtelCaptureContent" | ||
| }, | ||
| "markdownDescription": "Capture input/output messages, system instructions, and tool definitions in OTel telemetry. **Contains potentially sensitive data.** Configurable in user settings only. Env var `COPILOT_OTEL_CAPTURE_CONTENT` takes precedence. Requires window reload.", |
9 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds enterprise managed-settings policies for OpenTelemetry, covering both VS Code OTel surfaces without introducing a new settings namespace.
What
chat.agentHost.otel.*settings own the OTel policies; the Copilot extension'sgithub.copilot.chat.otel.*settings reference them viapolicyReference(same pattern asClaude3PIntegration).telemetryschema:telemetry.enabled,telemetry.endpoint,telemetry.protocol,telemetry.captureContent,telemetry.lockCaptureContent.Notes
telemetryblock is tracked separately (github/agent-control-plane#658, github/copilot-agent-runtime#10735); until that ships, validate via the mock policy server or native MDM.headers/resourceAttributes/serviceNamefrom the shared schema are not enforced in VS Code yet (follow-up).Test