Skip to content

Conversation

@praveenkuttappan
Copy link
Member

Initial draft of telemetry collection process overview.

@praveenkuttappan praveenkuttappan self-assigned this Feb 5, 2026
@github-actions github-actions bot added the azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli label Feb 5, 2026
praveenkuttappan and others added 2 commits February 5, 2026 17:43
Co-authored-by: Mariana Rios Flores <mariari@microsoft.com>
@praveenkuttappan praveenkuttappan marked this pull request as ready for review February 5, 2026 23:57
@praveenkuttappan praveenkuttappan requested a review from a team as a code owner February 5, 2026 23:57
Copilot AI review requested due to automatic review settings February 5, 2026 23:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive documentation for telemetry collection of Copilot agent activities related to Azure SDK Tools Agent usage. The design proposes a mandatory local activity log mechanism that captures user interactions, skill/tool invocations, and workflow execution to enable data-driven improvements to the Copilot experience.

Changes:

  • Added new documentation file describing the telemetry collection architecture, including logging requirements, log format specifications, ingestion mechanisms (CLI-based and VS Code extension-based), and reporting structure
  • Defined structured log entry format with required fields and activity types
  • Specified Copilot instructions for mandatory logging behavior


### 8.1 Activity Ingestion using CLI

Copilot writes to `.azsdk-agent-activity.log`. Copilot instruction contains the instruction to push activity logs to telemetry periodically. Copilot will run below azsdk cli command to push activity log entries and CLI parses new log entries and emits telemetry to Application Insights. This will also clear entires in the activity log to make sure activity log size is not taking up a lot of space.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document mentions that the activity log file can grow over time and needs to be cleared periodically (line 168), but there's no specification for maximum file size limits, rotation policies, or what happens if the disk fills up. Without these operational safeguards, the log file could grow unbounded and cause disk space issues. Consider adding specifications for file size limits, rotation strategies, or cleanup policies.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't view this as much of a problem in this particular case -- we're unlikely to fill up a disk based on user actions -- but if we adopted this technique in other (more automated) scenarios, it could become a problem. Should log an issue to revisit this.

- Ensure:
- Deterministic logging
- Synchronous append
- Logging is never ignored or de-prioritized
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "de-prioritized" should use consistent hyphenation. Throughout the document, "deprioritized" is used without a hyphen (line 97). Consider using "deprioritized" here for consistency.

Suggested change
- Logging is never ignored or de-prioritized
- Logging is never ignored or deprioritized

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +120
- Full user input (verbatim)
- Description of the action taken
- Tool / skill / instruction / CLI name
- Outcome (success | failure | partial | skipped)
- Outcome details
```

## 5. Log Entry Structure

Each activity is logged as a structured, append-only text block. One block represents one activity.

### 5.1 Required Fields

| Field | Description |
|------|-------------|
| `Timestamp` | ISO 8601 UTC timestamp |
| `ActivityType` | Type of activity |
| `UserInput` | Full verbatim user request |
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document states that PII redaction will not occur at log time (line 39), yet the instruction requires logging "Full user input (verbatim)" (line 103) and "Full verbatim user request" (line 120). This presents a security concern as user input may contain sensitive information (API keys, passwords, personal data, etc.). The document should either clarify how PII will be handled before ingestion to Application Insights, or reconsider the requirement to log full verbatim user input. Consider adding sanitization requirements or documenting clear guidance on PII handling in the ingestion layer.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Copilot here -- should be "verbatim except that any PII information (keys, passwords, etc.) will be redacted using the placeholder [REDACTED]".

We should catch as much of this beforehand as we can.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also redact profanity and other "not office safe" speech.

Example Command

```shell
azsdk telemetry ingest activity-log --path .azsdk-agent-activity.log
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed CLI command "azsdk telemetry ingest activity-log" is not documented in the existing CLI command guidelines. According to the repository's CLI command guidelines (tools/azsdk-cli/docs/cli-commands-guidelines.md), commands follow a specific hierarchy with predefined top-level command groups (package, release-plan, typespec). This new command introduces a new top-level command group "telemetry" which should be formally documented in the command guidelines, including its namespace, command group, and examples following the established pattern.

Suggested change
azsdk telemetry ingest activity-log --path .azsdk-agent-activity.log
azsdk package telemetry ingest-activity-log --path .azsdk-agent-activity.log

Copilot uses AI. Check for mistakes.

### 8.1 Activity Ingestion using CLI

Copilot writes to `.azsdk-agent-activity.log`. Copilot instruction contains the instruction to push activity logs to telemetry periodically. Copilot will run below azsdk cli command to push activity log entries and CLI parses new log entries and emits telemetry to Application Insights. This will also clear entires in the activity log to make sure activity log size is not taking up a lot of space.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI-based ingestion approach states it will "clear entries in the activity log" after pushing them (line 168). However, there's no mention of handling the case where the ingestion itself fails. If entries are cleared before confirming successful telemetry emission to Application Insights, data loss could occur. The design should specify whether entries are cleared before or after successful ingestion, and how failed ingestion attempts are handled to prevent data loss.

Copilot uses AI. Check for mistakes.
Comment on lines +159 to +162
- Copilot execution continues uninterrupted.
- Failure MUST be logged on the next successful write.
- Logging failures MUST NOT block tools, skills, or CLI execution.
- Retry logic is not required.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design claims logging must be "Synchronous" (line 53) and states in section 4 that "This requirement is mandatory and MUST NOT be ignored, forgotten, or deprioritized" (line 97). However, section 7 indicates that if writing fails, "Copilot execution continues uninterrupted" and "Logging failures MUST NOT block tools, skills, or CLI execution" (lines 159-161). These requirements are contradictory. If logging is truly mandatory and synchronous, failures should block execution. If execution should continue on failure, logging is effectively optional/best-effort. The design should clarify whether logging is mandatory-blocking or best-effort-non-blocking.

Suggested change
- Copilot execution continues uninterrupted.
- Failure MUST be logged on the next successful write.
- Logging failures MUST NOT block tools, skills, or CLI execution.
- Retry logic is not required.
- Logging is **mandatory best-effort**: every activity MUST attempt a synchronous write to the activity log.
- If a write attempt fails, Copilot execution continues uninterrupted and the user-facing operation MUST NOT fail solely due to the logging failure.
- The logging failure itself MUST be recorded as a `LoggingFailure` activity on the next successful write.
- Logging failures MUST NOT block tools, skills, or CLI execution beyond the time taken for the single failed write attempt.
- Additional retry logic beyond the next-successful-write behavior is not required.

Copilot uses AI. Check for mistakes.
Copy link
Member

@MattGertz MattGertz Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if the entries are timestamped based on when the action happened, then synchronicity is less of a concern -- it can be reassembled properly.

- **Location:** Repository root or workspace root
- **Format:** Plain text, structured blocks
- **Write Mode:** Append‑only
- **Write Timing:** Synchronous
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document specifies "Append-only" write mode (line 52) and "Synchronous append" (line 29), but doesn't address potential concurrency issues. If multiple Copilot processes or instances are running simultaneously in the same workspace (e.g., multiple VS Code windows, or concurrent CLI invocations), there could be race conditions or corruption when appending to the same log file. The design should specify whether file locking mechanisms are required or if concurrent writes are a concern that needs to be addressed.

Suggested change
- **Write Timing:** Synchronous
- **Write Timing:** Synchronous
- **Concurrency:** Multiple Copilot processes or instances MAY write to the same log file. Implementations MUST ensure that log entries are not corrupted under concurrent writes, either by using an OS/file‑system append mode with atomic write guarantees for each entry or by writing to separate per‑process log files (for example, suffixed with a process or instance identifier) that are merged during ingestion.

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +207
azsdk telemetry ingest activity-log --path .azsdk-agent-activity.log
```

### Characteristics

- Explicit, opt-in ingestion
- Works locally and in CI
- No editor dependency
- Telemetry visibility is delayed

### 8.2. VS Code Extension Ingestion (Alternate option to CLI based ingestion)

Copilot continues to write activity entries locally to the `.azsdk-agent-activity.log` file in the repository or workspace root.

A dedicated VS Code extension is responsible for monitoring this file and ingesting new log entries into Azure Application Insights in near real time.

### Responsibilities

- Watch the `.azsdk-agent-activity.log` file using a `FileSystemWatcher`
- Detect newly appended log entries
- Track last ingested offset or timestamp to avoid duplicate ingestion
- Parse log entries into the normalized telemetry schema
- Enrich events with editor context (workspace name, language mode, OS, extension version)
- Respect VS Code telemetry opt-in / opt-out settings
- Batch and emit telemetry to Application Insights using the SDK

### Processing Flow

1. Extension activates on workspace open
2. File watcher attaches to `.azsdk-agent-activity.log`
3. On file change, read newly appended content only
4. Parse each activity block into structured fields
5. Map fields to Application Insights `customEvents`
6. Send events asynchronously (non-blocking)
7. Persist ingestion checkpoint locally
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VS Code extension ingestion approach mentions tracking "last ingested offset or timestamp to avoid duplicate ingestion" (line 193) and "Persist ingestion checkpoint locally" (line 207). However, the CLI-based approach doesn't mention any similar mechanism to track what has been ingested. If the CLI command is run multiple times, it could result in duplicate telemetry events being sent to Application Insights unless there's a mechanism to track which entries have already been processed. The design should clarify how duplicates are prevented in the CLI-based approach.

Copilot uses AI. Check for mistakes.
- Track last ingested offset or timestamp to avoid duplicate ingestion
- Parse log entries into the normalized telemetry schema
- Enrich events with editor context (workspace name, language mode, OS, extension version)
- Respect VS Code telemetry opt-in / opt-out settings
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VS Code extension ingestion approach mentions "Respect VS Code telemetry opt-in / opt-out settings" (line 196), but there's no mention of similar opt-in/opt-out mechanisms for CLI-based ingestion or the logging itself. This creates an inconsistency in user privacy controls. The document should clarify whether users can opt-out of telemetry collection entirely, and if so, how the Copilot instruction would be disabled or the logging bypassed. This is important for compliance with privacy regulations and user preferences.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +121
| `ActivityType` | Type of activity |
| `UserInput` | Full verbatim user request |
| `Action` | Description of action taken |
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design mandates logging UserInput as "Full verbatim user request" and explicitly states there will be "No PII redaction of raw user input at log time", which creates a high risk of capturing secrets and personal data in .azsdk-agent-activity.log and downstream telemetry (e.g., Application Insights). In realistic use, developers often paste connection strings, keys, tokens, and other sensitive details into prompts, so this requirement will systematically exfiltrate that data into logs and remote telemetry stores beyond user intent and may violate privacy/compliance expectations. Please revise the design to avoid logging full raw input by default (e.g., minimize/partition fields, apply robust redaction/scrubbing before persistence or ingestion, and/or make capture of full prompts an explicit, well-documented opt-in with clear consent).

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(See previous comment.)

### 2.2 Non‑Goals

- No real‑time telemetry emission from Copilot runtime
- No PII redaction of raw user input at log time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line. We should not state this as a non-goal. Not only will this tend to make users shy away from turning on logging (since they will read this doc) and cause people to misinterpret our dedication to security, but it could also have unforeseen consequences vis-a-vis how the agent/LLM "interprets" this command all-up (i.e. we could easily find ourselves with even more PII baked in when it would have normally stripped it).

We definitely need human eyes to review logs before sending, but anything that the agent can strip out beforehand is nothing but goodness.

@@ -0,0 +1,223 @@
# Logging Design for the Azure SDK Tools Agent Copilot Activity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My overall comments for this document:
(1) I think logging instructions and logging explanations (e.g. "powerbi site will show...") should be in different docs. The AI doesn't need to know the explanations, and it just makes the context window a bit more muddy than it needs to be.

(2) The PII-related stuff needs to be reworked to attempt redaction, and that needs to include any non-office-safe text such as profanity. (Humans should validate before it's sent, but we need to make that as easy as possible by cleaning it out as much as the AI can.)

Copy link
Member

@MattGertz MattGertz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My overall comments for this document:
(1) I think logging instructions and logging explanations (e.g. "powerbi site will show...") should be in different docs. The AI doesn't need to know the explanations, and it just makes the context window a bit more muddy than it needs to be.

(2) The PII-related stuff needs to be reworked to attempt redaction, and that needs to include any non-office-safe text such as profanity. (Humans should validate before it's sent, but we need to make that as easy as possible by cleaning it out as much as the AI can.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azsdk-cli Issues related to Azure/azure-sdk-tools::tools/azsdk-cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants