Update: add telemetry service (#161)

* init: telemetry for qwen code

* fix

* update
This commit is contained in:
Fan
2025-07-31 21:12:22 +08:00
committed by GitHub
parent e27610789f
commit dc6dcea93d
9 changed files with 151 additions and 109 deletions

View File

@@ -93,7 +93,7 @@ describe('Server Config (config.ts)', () => {
const QUESTION = 'test question';
const FULL_CONTEXT = false;
const USER_MEMORY = 'Test User Memory';
const TELEMETRY_SETTINGS = { enabled: false };
const TELEMETRY_SETTINGS = { enabled: true };
const EMBEDDING_MODEL = 'gemini-embedding';
const SESSION_ID = 'test-session-id';
const baseParams: ConfigParameters = {

View File

@@ -37,13 +37,11 @@ import {
DEFAULT_TELEMETRY_TARGET,
DEFAULT_OTLP_ENDPOINT,
TelemetryTarget,
StartSessionEvent,
} from '../telemetry/index.js';
import {
DEFAULT_GEMINI_EMBEDDING_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
} from './models.js';
import { ClearcutLogger } from '../telemetry/clearcut-logger/clearcut-logger.js';
export enum ApprovalMode {
DEFAULT = 'default',
@@ -246,7 +244,7 @@ export class Config {
this.showMemoryUsage = params.showMemoryUsage ?? false;
this.accessibility = params.accessibility ?? {};
this.telemetrySettings = {
enabled: params.telemetry?.enabled ?? false,
enabled: params.telemetry?.enabled ?? true,
target: params.telemetry?.target ?? DEFAULT_TELEMETRY_TARGET,
otlpEndpoint: params.telemetry?.otlpEndpoint ?? DEFAULT_OTLP_ENDPOINT,
logPrompts: params.telemetry?.logPrompts ?? true,
@@ -285,9 +283,10 @@ export class Config {
}
if (this.getUsageStatisticsEnabled()) {
ClearcutLogger.getInstance(this)?.logStartSessionEvent(
new StartSessionEvent(this),
);
// ClearcutLogger.getInstance(this)?.logStartSessionEvent(
// new StartSessionEvent(this),
// );
console.log('ClearcutLogger disabled - no data collection.');
} else {
console.log('Data collection is disabled.');
}
@@ -530,7 +529,7 @@ export class Config {
}
getUsageStatisticsEnabled(): boolean {
return false; // 禁用遥测统计,防止网络请求
return this.usageStatisticsEnabled;
}
getExtensionContextFilePaths(): string[] {