Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 0.6.1

### New Features & Improvements

- **Feedback Optimization**: Introduces privacy consent and feedback signal controls for the Query Insights feature, primarily to ensure compliance with organizational data protection requirements and user telemetry settings. It also disables survey functionality and refines the feedback dialog UI. [#392](https://github.com/microsoft/vscode-documentdb/pull/392)

### Fixes

- **Privacy Policy Link**: Updated the outdated privacy policy link in the README to the current Microsoft privacy statement URL. [#388](https://github.com/microsoft/vscode-documentdb/pull/388)

## 0.6.0

### New Features & Improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ This project may contain trademarks or logos for projects, products, or services

# Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkID=528096&clcid=0x409) to learn more. If you don’t wish to send usage data to Microsoft, you can set the `telemetry.enableTelemetry` setting to `false`. Learn more in our [FAQ](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).
VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to learn more. If you don’t wish to send usage data to Microsoft, you can set the `telemetry.enableTelemetry` setting to `false`. Learn more in our [FAQ](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).

# License

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The User Manual provides guidance on using DocumentDB for VS Code. It contains d

Explore the history of updates and improvements to the DocumentDB for VS Code extension. Each release brings new features, enhancements, and fixes to improve your experience.

- [0.6](./release-notes/0.6)
- [0.6](./release-notes/0.6), [0.6.1](./release-notes/0.6#patch-release-v061)
- [0.5](./release-notes/0.5), [0.5.1](./release-notes/0.5#patch-release-v051), [0.5.2](./release-notes/0.5#patch-release-v052)
- [0.4](./release-notes/0.4), [0.4.1](./release-notes/0.4#patch-release-v041)
- [0.3](./release-notes/0.3), [0.3.1](./release-notes/0.3#patch-release-v031)
Expand Down
61 changes: 41 additions & 20 deletions docs/release-notes/0.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ We are excited to announce the release of **DocumentDB for VS Code Extension v0.

We are introducing a major new feature: **Query Insights with Performance Advisor**. This powerful tool helps you understand and optimize your queries directly within VS Code. When you run a `find` query against your DocumentDB or MongoDB API database, a new **"Query Insights"** tab appears, providing a three-stage analysis of your query's performance.

<p align="center"><img src="./images/0.6.0_query_insights.png" alt="Authentication Method Selection" width="720" style="max-width:100%;height:auto;"></p>
<p align="center"><img src="./images/0.6.0_query_insights.png" alt="Authentication Method Selection" width="800" style="max-width:100%;height:auto;"></p>

- **Stage 1: Initial Performance View**
The first stage provides an immediate, low-cost static analysis of your query. It visualizes the query plan, showing how the database intends to execute your query. This helps you understand performance bottlenecks and the query's processing stages without re-running it.
- **Stage 1: Initial Performance View**
The first stage provides an immediate, low-cost static analysis of your query. It visualizes the query plan, showing how the database intends to execute your query. This helps you understand performance bottlenecks and the query's processing stages without re-running it.

- **Stage 2: Detailed Execution Analysis**
For a deeper dive, the second stage runs a detailed execution analysis using `executionStats` to gather authoritative metrics. You'll see precise counts for documents and keys examined, server-side execution time, and a detailed breakdown of each stage in the execution plan. This provides clear insights into how your query actually performed.
- **Stage 2: Detailed Execution Analysis**
For a deeper dive, the second stage runs a detailed execution analysis using `executionStats` to gather authoritative metrics. You'll see precise counts for documents and keys examined, server-side execution time, and a detailed breakdown of each stage in the execution plan. This provides clear insights into how your query actually performed.

The complex JSON response from the database is translated into an easy-to-comprehend chart, making it simple to visualize the query's execution flow.
The complex JSON response from the database is translated into an easy-to-comprehend chart, making it simple to visualize the query's execution flow.

Additionally, a **Query Efficiency Analysis** card provides a quick performance assessment. It highlights key aspects of the query's execution, such as the execution strategy, index usage, and whether an in-memory sort occurred. A performance rating (Good, Fair, or Poor) helps you quickly identify an inefficient or slow query.
Additionally, a **Query Efficiency Analysis** card provides a quick performance assessment. It highlights key aspects of the query's execution, such as the execution strategy, index usage, and whether an in-memory sort occurred. A performance rating (Good, Fair, or Poor) helps you quickly identify an inefficient or slow query.

- **Stage 3: AI-Powered Recommendations with GitHub Copilot**
The final stage brings the power of AI to your query optimization workflow. By clicking `Get AI Performance Insights`, the extension sends the query shape and execution statistics to a service powered by **GitHub Copilot**. For more details, please see our [documentation](https://learn.microsoft.com/en-us/azure/documentdb/index-advisor).
- **Stage 3: AI-Powered Recommendations with GitHub Copilot**
The final stage brings the power of AI to your query optimization workflow. By clicking `Get AI Performance Insights`, the extension sends the query shape and execution statistics to a service powered by **GitHub Copilot**. For more details, please see our [documentation](https://learn.microsoft.com/en-us/azure/documentdb/index-advisor).

The AI assistant provides:
The AI assistant provides:

> 🕵️‍♂️ **Analysis**
>
> A summary of the query's performance.
> 🕵️‍♂️ **Analysis**
>
> A summary of the query's performance.

> 📈 **Actionable Recommendations**
>
> Suggestions for creating, hiding, or unhiding indexes to improve performance, with an option to apply them directly.
> 📈 **Actionable Recommendations**
>
> Suggestions for creating, hiding, or unhiding indexes to improve performance, with an option to apply them directly.

> 🎓 **Detailed Explanations**
>
> A breakdown of the execution plan to help you understand how the query was processed.
> 🎓 **Detailed Explanations**
>
> A breakdown of the execution plan to help you understand how the query was processed.

The **"Query Insights"** feature helps solve performance issues and educates users on query best practices for DocumentDB and MongoDB API databases.

Expand All @@ -49,7 +49,7 @@ We've enhanced the query authoring experience to support more sophisticated quer

The `projection` and `sort` fields also support the same rich autocompletion that was previously available for the `filter` field.

<p align="center"><img src="./images/0.6.0_project_sort_skip_limit.png" alt="Authentication Method Selection" width="720" style="max-width:100%;height:auto;"></p>
<p align="center"><img src="./images/0.6.0_project_sort_skip_limit.png" alt="Authentication Method Selection" width="800" style="max-width:100%;height:auto;"></p>

### ⭐ Index Management from the Tree View

Expand All @@ -69,3 +69,24 @@ Hovering over an index will show you its details, and the context menu provides

See the full changelog entry for this release:
➡️ [CHANGELOG.md#060](https://github.com/microsoft/vscode-documentdb/blob/main/CHANGELOG.md#060)

---

## Patch Release v0.6.1

This patch release introduces feedback optimization and fixes a broken link.

### What's Changed in v0.6.1

#### **Feedback Optimization** ([#392](https://github.com/microsoft/vscode-documentdb/pull/392))

Introduces privacy consent and feedback signal controls for the Query Insights feature, primarily to ensure compliance with organizational data protection requirements and user telemetry settings. It also disables survey functionality and refines the feedback dialog UI.

#### **Privacy Policy Link Update** ([#388](https://github.com/microsoft/vscode-documentdb/pull/388))

Updated the outdated privacy policy link in the README to the current Microsoft privacy statement URL.

### Changelog

See the full changelog entry for this release:
➡️ [CHANGELOG.md#061](https://github.com/microsoft/vscode-documentdb/blob/main/CHANGELOG.md#061)
4 changes: 3 additions & 1 deletion l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
"HIGH PRIORITY": "HIGH PRIORITY",
"How do you want to connect?": "How do you want to connect?",
"How would you rate Query Insights?": "How would you rate Query Insights?",
"I have read and agree to the ": "I have read and agree to the ",
"I like it": "I like it",
"I want to choose the server from an online registry.": "I want to choose the server from an online registry.",
"I want to connect to a local DocumentDB instance.": "I want to connect to a local DocumentDB instance.",
Expand Down Expand Up @@ -484,6 +485,7 @@
"Manage Azure Accounts": "Manage Azure Accounts",
"Manually enter a custom tenant ID": "Manually enter a custom tenant ID",
"MEDIUM PRIORITY": "MEDIUM PRIORITY",
"Microsoft will process the feedback data you submit on behalf of your organization in accordance with the Data Protection Addendum between your organization and Microsoft.": "Microsoft will process the feedback data you submit on behalf of your organization in accordance with the Data Protection Addendum between your organization and Microsoft.",
"Migration of connections from the Azure Databases VS Code Extension to the DocumentDB for VS Code Extension completed: {migratedCount} connections migrated.": "Migration of connections from the Azure Databases VS Code Extension to the DocumentDB for VS Code Extension completed: {migratedCount} connections migrated.",
"Missing important information": "Missing important information",
"Modify index?": "Modify index?",
Expand Down Expand Up @@ -558,10 +560,10 @@
"Port number is required": "Port number is required",
"Port number must be a number": "Port number must be a number",
"Port number must be between 1 and 65535": "Port number must be between 1 and 65535",
"Privacy Statement": "Privacy Statement",
"Procedure not found: {name}": "Procedure not found: {name}",
"Process exited: \"{command}\"": "Process exited: \"{command}\"",
"Project": "Project",
"Provide Feedback": "Provide Feedback",
"Provider \"{0}\" does not have resource type \"{1}\".": "Provider \"{0}\" does not have resource type \"{1}\".",
"Query Efficiency Analysis": "Query Efficiency Analysis",
"Query Execution Failed": "Query Execution Failed",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-documentdb",
"version": "0.6.0",
"version": "0.6.1",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"publisher": "ms-azuretools",
"displayName": "DocumentDB for VS Code",
Expand Down
14 changes: 14 additions & 0 deletions src/commands/openCollectionView/openCollectionView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import { type IActionContext } from '@microsoft/vscode-azext-utils';
import * as l10n from '@vscode/l10n';
import * as vscode from 'vscode';

import { ClusterSession } from '../../documentdb/ClusterSession';
import { type CollectionItem } from '../../tree/documentdb/CollectionItem';
import { CollectionViewController } from '../../webviews/documentdb/collectionView/collectionViewController';
Expand Down Expand Up @@ -37,11 +39,23 @@ export async function openCollectionViewInternal(
*/
const sessionId = await ClusterSession.initNewSession(props.clusterId);

// Enable feedback signals only when telemetry level is set to "all"
// See: https://code.visualstudio.com/docs/setup/enterprise#_configure-telemetry-level
let feedbackSignalsEnabled = false;
try {
const telemetryLevel = vscode.workspace.getConfiguration('telemetry').get<string>('telemetryLevel');
feedbackSignalsEnabled = telemetryLevel === 'all';
} catch {
// If we fail to read telemetry settings, default to false
feedbackSignalsEnabled = false;
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

The variable feedbackSignalsEnabled is initialized to false on line 44 and then potentially reassigned in the try block (line 47). However, the catch block on line 48 also sets it to false (line 50), which is redundant since it already has this value from the initialization. Consider removing the assignment in the catch block since the initial value already serves as the fallback.

Suggested change
feedbackSignalsEnabled = false;

Copilot uses AI. Check for mistakes.
}

const view = new CollectionViewController({
sessionId: sessionId,
clusterId: props.clusterId,
databaseName: props.databaseName,
collectionName: props.collectionName,
feedbackSignalsEnabled: feedbackSignalsEnabled,
});

view.revealToForeground();
Expand Down
3 changes: 3 additions & 0 deletions src/utils/survey.initSurvey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ describe('Survey Initialization', () => {
// This directly modifies the surveyState object in the survey.ts module
surveyStateRef.isCandidate = undefined;

// Enable survey for tests (it's disabled in production)
SurveyConfig.settings.DISABLE_SURVEY = false;

// Set up default A/B test mocks for passing
mockABTestPassing();

Expand Down
3 changes: 3 additions & 0 deletions src/utils/survey.prompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ describe('Survey Prompt', () => {
surveyState.wasPromptedInSession = false;
surveyState.isCandidate = true;

// Enable survey for tests (it's disabled in production)
surveyConfig.settings.DISABLE_SURVEY = false;

// Reset mocks
jest.clearAllMocks();

Expand Down
3 changes: 3 additions & 0 deletions src/utils/survey.scoring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ describe('Survey Scoring', () => {
surveyState.usageScore = 0;
surveyState.wasPromptedInSession = false;

// Enable survey for tests (it's disabled in production)
surveyConfig.settings.DISABLE_SURVEY = false;

// Clear mock calls between tests
jest.clearAllMocks();
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SurveyConfig = {
},
settings: {
DEBUG_ALWAYS_PROMPT: false, // Forces survey prompt regardless of conditions
DISABLE_SURVEY: false, // Completely disables survey functionality
DISABLE_SURVEY: true, // Completely disables survey functionality
PROBABILITY: 1, // Probability to become candidate (0-1), Azure Tools uses 0.15
A_B_TEST_SELECTION: 1, // change this value to adjust the candidate selection (e.g. 0.50 for 50% of users)
PROMPT_ENGLISH_ONLY: false, // Whether to limit survey to English locales
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type CollectionViewWebviewConfigurationType = {
databaseName: string;
collectionName: string;
defaultPageSize: number;
feedbackSignalsEnabled: boolean;
};

export class CollectionViewController extends WebviewController<CollectionViewWebviewConfigurationType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ import { ChatMailRegular, SparkleRegular, WarningRegular } from '@fluentui/react
import { CollapseRelaxed } from '@fluentui/react-motion-components-preview';
import * as l10n from '@vscode/l10n';
import { useCallback, useContext, useEffect, useState, type JSX } from 'react';
import { useConfiguration } from '../../../../api/webview-client/useConfiguration';
import { useTrpcClient } from '../../../../api/webview-client/useTrpcClient';
import { CollectionViewContext } from '../../collectionViewContext';
import { type CollectionViewWebviewConfigurationType } from '../../collectionViewController';
import { type ImprovementCard as ImprovementCardConfig } from '../../types/queryInsights';
import { extractErrorCode } from '../../utils/errorCodeExtractor';
import { AnimatedCardList, FeedbackCard, FeedbackDialog, type AnimatedCardItem } from './components';
Expand All @@ -62,6 +64,11 @@ export const QueryInsightsMain = (): JSX.Element => {
// Stage 3: AI-Powered Recommendations (opt-in)
// See: docs/design-documents/performance-advisor.md

/**
* Use the configuration object to access the data passed to the webview at its creation.
*/
const configuration = useConfiguration<CollectionViewWebviewConfigurationType>();

const { trpcClient } = useTrpcClient();
const [currentContext, setCurrentContext] = useContext(CollectionViewContext);
const { queryInsights: queryInsightsState } = currentContext;
Expand Down Expand Up @@ -858,9 +865,10 @@ export const QueryInsightsMain = (): JSX.Element => {
/>

{/* Feedback Card - hidden for RU accounts where Query Insights is not available */}
{queryInsightsState.stage1ErrorCode !== 'QUERY_INSIGHTS_PLATFORM_NOT_SUPPORTED_RU' && (
<FeedbackCard onFeedback={handleFeedbackClick} />
)}
{configuration.feedbackSignalsEnabled &&
queryInsightsState.stage1ErrorCode !== 'QUERY_INSIGHTS_PLATFORM_NOT_SUPPORTED_RU' && (
<FeedbackCard onFeedback={handleFeedbackClick} />
)}
</div>
</div>

Expand Down
Loading
Loading