Refactor usage statistics to be a top-level setting (#1363)
This commit refactors the `usageStatisticsEnabled` setting from a sub-property of the `telemetry` configuration to a top-level setting. This change simplifies the configuration by decoupling usage statistics from the telemetry settings. The documentation has also been updated to reflect this change.
This commit is contained in:
parent
b3741f7016
commit
aca034fdfe
|
@ -169,7 +169,6 @@ In addition to a project settings file, a project's `.gemini` directory can cont
|
||||||
- **`target`** (string): The destination for collected telemetry. Supported values are `local` and `gcp`.
|
- **`target`** (string): The destination for collected telemetry. Supported values are `local` and `gcp`.
|
||||||
- **`otlpEndpoint`** (string): The endpoint for the OTLP Exporter.
|
- **`otlpEndpoint`** (string): The endpoint for the OTLP Exporter.
|
||||||
- **`logPrompts`** (boolean): Whether or not to include the content of user prompts in the logs.
|
- **`logPrompts`** (boolean): Whether or not to include the content of user prompts in the logs.
|
||||||
- **`usageStatisticsEnabled`** (boolean): Enables or disables the collection of usage statistics. See [Usage Statistics](#usage-statistics) for more information.
|
|
||||||
- **Example:**
|
- **Example:**
|
||||||
```json
|
```json
|
||||||
"telemetry": {
|
"telemetry": {
|
||||||
|
@ -179,6 +178,13 @@ In addition to a project settings file, a project's `.gemini` directory can cont
|
||||||
"logPrompts": false
|
"logPrompts": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
- **`usageStatisticsEnabled`** (boolean):
|
||||||
|
- **Description:** Enables or disables the collection of usage statistics. See [Usage Statistics](#usage-statistics) for more information.
|
||||||
|
- **Default:** `true`
|
||||||
|
- **Example:**
|
||||||
|
```json
|
||||||
|
"usageStatisticsEnabled": false
|
||||||
|
```
|
||||||
|
|
||||||
### Example `settings.json`:
|
### Example `settings.json`:
|
||||||
|
|
||||||
|
@ -201,9 +207,9 @@ In addition to a project settings file, a project's `.gemini` directory can cont
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"target": "local",
|
"target": "local",
|
||||||
"otlpEndpoint": "http://localhost:4317",
|
"otlpEndpoint": "http://localhost:4317",
|
||||||
"logPrompts": true,
|
"logPrompts": true
|
||||||
"usageStatisticsEnabled": false
|
},
|
||||||
}
|
"usageStatisticsEnabled": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -423,18 +429,6 @@ You can opt out of usage statistics collection at any time by setting the `usage
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"telemetry": {
|
"usageStatisticsEnabled": false
|
||||||
"usageStatisticsEnabled": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also disable all telemetry data collection by setting the `enabled` property to `false`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"telemetry": {
|
|
||||||
"enabled": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -20,7 +20,6 @@ This documentation is organized into the following sections:
|
||||||
- **[Telemetry](./telemetry.md):** Overview of telemetry in the CLI.
|
- **[Telemetry](./telemetry.md):** Overview of telemetry in the CLI.
|
||||||
- **Core Details:** Documentation for `packages/core`.
|
- **Core Details:** Documentation for `packages/core`.
|
||||||
- **[Core Introduction](./core/index.md):** Overview of the core component.
|
- **[Core Introduction](./core/index.md):** Overview of the core component.
|
||||||
- **[Telemetry and Usage Statistics](./core/telemetry.md):** Details on configuring telemetry and usage statistics.
|
|
||||||
- **[Tools API](./core/tools-api.md):** Information on how the core manages and exposes tools.
|
- **[Tools API](./core/tools-api.md):** Information on how the core manages and exposes tools.
|
||||||
- **Tools:**
|
- **Tools:**
|
||||||
- **[Tools Overview](./tools/index.md):** Overview of the available tools.
|
- **[Tools Overview](./tools/index.md):** Overview of the available tools.
|
||||||
|
|
|
@ -226,9 +226,8 @@ export async function loadCliConfig(
|
||||||
process.env.OTEL_EXPORTER_OTLP_ENDPOINT ??
|
process.env.OTEL_EXPORTER_OTLP_ENDPOINT ??
|
||||||
settings.telemetry?.otlpEndpoint,
|
settings.telemetry?.otlpEndpoint,
|
||||||
logPrompts: argv.telemetryLogPrompts ?? settings.telemetry?.logPrompts,
|
logPrompts: argv.telemetryLogPrompts ?? settings.telemetry?.logPrompts,
|
||||||
usageStatisticsEnabled:
|
|
||||||
settings.telemetry?.usageStatisticsEnabled ?? true,
|
|
||||||
},
|
},
|
||||||
|
usageStatisticsEnabled: settings.usageStatisticsEnabled ?? true,
|
||||||
// Git-aware file filtering settings
|
// Git-aware file filtering settings
|
||||||
fileFiltering: {
|
fileFiltering: {
|
||||||
respectGitIgnore: settings.fileFiltering?.respectGitIgnore,
|
respectGitIgnore: settings.fileFiltering?.respectGitIgnore,
|
||||||
|
|
|
@ -49,6 +49,7 @@ export interface Settings {
|
||||||
contextFileName?: string | string[];
|
contextFileName?: string | string[];
|
||||||
accessibility?: AccessibilitySettings;
|
accessibility?: AccessibilitySettings;
|
||||||
telemetry?: TelemetrySettings;
|
telemetry?: TelemetrySettings;
|
||||||
|
usageStatisticsEnabled?: boolean;
|
||||||
preferredEditor?: string;
|
preferredEditor?: string;
|
||||||
bugCommand?: BugCommandSettings;
|
bugCommand?: BugCommandSettings;
|
||||||
checkpointing?: CheckpointingSettings;
|
checkpointing?: CheckpointingSettings;
|
||||||
|
|
|
@ -57,7 +57,6 @@ export interface TelemetrySettings {
|
||||||
target?: TelemetryTarget;
|
target?: TelemetryTarget;
|
||||||
otlpEndpoint?: string;
|
otlpEndpoint?: string;
|
||||||
logPrompts?: boolean;
|
logPrompts?: boolean;
|
||||||
usageStatisticsEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MCPServerConfig {
|
export class MCPServerConfig {
|
||||||
|
@ -107,6 +106,7 @@ export interface ConfigParameters {
|
||||||
contextFileName?: string | string[];
|
contextFileName?: string | string[];
|
||||||
accessibility?: AccessibilitySettings;
|
accessibility?: AccessibilitySettings;
|
||||||
telemetry?: TelemetrySettings;
|
telemetry?: TelemetrySettings;
|
||||||
|
usageStatisticsEnabled?: boolean;
|
||||||
fileFiltering?: {
|
fileFiltering?: {
|
||||||
respectGitIgnore?: boolean;
|
respectGitIgnore?: boolean;
|
||||||
enableRecursiveFileSearch?: boolean;
|
enableRecursiveFileSearch?: boolean;
|
||||||
|
@ -142,6 +142,7 @@ export class Config {
|
||||||
private readonly showMemoryUsage: boolean;
|
private readonly showMemoryUsage: boolean;
|
||||||
private readonly accessibility: AccessibilitySettings;
|
private readonly accessibility: AccessibilitySettings;
|
||||||
private readonly telemetrySettings: TelemetrySettings;
|
private readonly telemetrySettings: TelemetrySettings;
|
||||||
|
private readonly usageStatisticsEnabled: boolean;
|
||||||
private geminiClient!: GeminiClient;
|
private geminiClient!: GeminiClient;
|
||||||
private readonly fileFiltering: {
|
private readonly fileFiltering: {
|
||||||
respectGitIgnore: boolean;
|
respectGitIgnore: boolean;
|
||||||
|
@ -181,8 +182,8 @@ export class Config {
|
||||||
target: params.telemetry?.target ?? DEFAULT_TELEMETRY_TARGET,
|
target: params.telemetry?.target ?? DEFAULT_TELEMETRY_TARGET,
|
||||||
otlpEndpoint: params.telemetry?.otlpEndpoint ?? DEFAULT_OTLP_ENDPOINT,
|
otlpEndpoint: params.telemetry?.otlpEndpoint ?? DEFAULT_OTLP_ENDPOINT,
|
||||||
logPrompts: params.telemetry?.logPrompts ?? true,
|
logPrompts: params.telemetry?.logPrompts ?? true,
|
||||||
usageStatisticsEnabled: params.telemetry?.usageStatisticsEnabled ?? true,
|
|
||||||
};
|
};
|
||||||
|
this.usageStatisticsEnabled = params.usageStatisticsEnabled ?? true;
|
||||||
|
|
||||||
this.fileFiltering = {
|
this.fileFiltering = {
|
||||||
respectGitIgnore: params.fileFiltering?.respectGitIgnore ?? true,
|
respectGitIgnore: params.fileFiltering?.respectGitIgnore ?? true,
|
||||||
|
@ -386,7 +387,7 @@ export class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUsageStatisticsEnabled(): boolean {
|
getUsageStatisticsEnabled(): boolean {
|
||||||
return this.telemetrySettings.usageStatisticsEnabled ?? true;
|
return this.usageStatisticsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
getExtensionContextFilePaths(): string[] {
|
getExtensionContextFilePaths(): string[] {
|
||||||
|
|
Loading…
Reference in New Issue